Skip to content

Commit

Permalink
fix(DatePicker): rename testing attributes to data-testid
Browse files Browse the repository at this point in the history
Also, include a rename in a couple of stories (to safe time).
  • Loading branch information
tujoworker committed Jun 13, 2022
1 parent c6a2a44 commit 2e1e285
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class DatePickerFooter extends React.PureComponent {
<Button
text={submit_button_text}
onClick={this.onSubmitHandler}
data-visual-test="submit"
data-testid="submit"
/>
)) || <span />}

Expand All @@ -128,7 +128,7 @@ export default class DatePickerFooter extends React.PureComponent {
icon_position="left"
variant="tertiary"
onClick={this.onResetHandler}
data-visual-test="reset"
data-testid="reset"
/>
)) || <span />}

Expand All @@ -139,7 +139,7 @@ export default class DatePickerFooter extends React.PureComponent {
icon_position="left"
variant="tertiary"
onClick={this.onCancelHandler}
data-visual-test="cancel"
data-testid="cancel"
/>
)) || <span />}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,15 @@ describe('DatePicker component', () => {
/>
)

const resetElem = Comp.find('button[data-visual-test="reset"]')
const resetElem = Comp.find('button[data-testid="reset"]')
expect(resetElem.exists()).toBe(true)
expect(resetElem.text()).toMatch('Tilbakestill')

const cancelElem = Comp.find('button[data-visual-test="cancel"]')
const cancelElem = Comp.find('button[data-testid="cancel"]')
expect(cancelElem.exists()).toBe(true)
expect(cancelElem.text()).toMatch('Avbryt')

const submitElem = Comp.find('button[data-visual-test="submit"]')
const submitElem = Comp.find('button[data-testid="submit"]')
expect(submitElem.exists()).toBe(true)
expect(submitElem.text()).toMatch('Ok')

Expand Down Expand Up @@ -368,7 +368,7 @@ describe('DatePicker component', () => {
/>
)

const resetElem = Comp.find('button[data-visual-test="reset"]')
const resetElem = Comp.find('button[data-testid="reset"]')
expect(resetElem.exists()).toBe(true)
expect(resetElem.text()).toMatch(reset_button_text)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
}

const CustomStyle = styled.div`
[data-visual-test='dropdown-list'].dnb-drawer-list__list {
[data-testid='dropdown-list'].dnb-drawer-list__list {
display: block;
visibility: visible;
position: relative;
Expand Down Expand Up @@ -539,7 +539,7 @@ const DropdownStory = () => {
</Box>
<Box>
<span
data-visual-test="dropdown-list"
data-testid="dropdown-list"
className="dnb-drawer-list__list"
>
<ul className="dnb-drawer-list__options">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Drawer = styled(DrawerList)`
margin-bottom: 4rem;
`
const CustomStyle = styled.div`
[data-visual-test='dropdown-list'].dnb-drawer-list__list {
[data-testid='dropdown-list'].dnb-drawer-list__list {
display: block;
visibility: visible;
position: relative;
Expand Down

0 comments on commit 2e1e285

Please sign in to comment.