Skip to content

Commit

Permalink
chore: fixed rounded prop and added tests to datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
BallardRobinett committed Oct 27, 2022
1 parent 750f425 commit 1300038
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/button-theme/__tests__/DatePicker.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { axe, toHaveNoViolations } from 'jest-axe';
import { render } from '@testing-library/react';
import React from 'react';
import DatePicker from '../src/DatePicker';
import DatePicker, { datepickerStyles } from '../src/DatePicker';
import '@testing-library/jest-dom/extend-expect';
import 'regenerator-runtime/runtime';
import { changeSelectorToObject } from '../../bcgov-theme/utils/test-helpers';

expect.extend(toHaveNoViolations);

Expand All @@ -14,4 +15,11 @@ describe('DatePicker', () => {

expect(results).toHaveNoViolations();
});

it('Should apply styles from props', () => {
render(<DatePicker id="test" rounded />);
const datepicker = document.getElementById('test');
const stylesObject = changeSelectorToObject(datepickerStyles.rounded.input);
expect(datepicker).toHaveStyle(stylesObject.base);
});
});
5 changes: 5 additions & 0 deletions packages/button-theme/src/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export const datepickerStyles = {
`,
},
},
rounded: {
input: `
border-radius: 0.25em;
`,
},
};

const config: StyleConfig = {
Expand Down

0 comments on commit 1300038

Please sign in to comment.