-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(dropdown): added unit tests #435
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! LGTM :)
packages/core/src/components/dropdown/test/default/dropdown.e2e.ts
Outdated
Show resolved
Hide resolved
packages/core/src/components/dropdown/test/default/dropdown.e2e.ts
Outdated
Show resolved
Hide resolved
packages/core/src/components/dropdown/test/error/dropdown.e2e.ts
Outdated
Show resolved
Hide resolved
packages/core/src/components/dropdown/test/default/dropdown.e2e.ts
Outdated
Show resolved
Hide resolved
packages/core/src/components/dropdown/test/error/dropdown.e2e.ts
Outdated
Show resolved
Hide resolved
const dropdownListElementOneButton = page | ||
.locator('tds-dropdown-option') | ||
.filter({ hasText: /Option 1/ }) | ||
.locator('tds-checkbox'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here as what I mentioned with the tds-icon in the error text actually. Maybe we could just remove the .locator('tds-checkbox') and it would still work right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah you're looking for the checked attribute 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, there is a ".toBeChecked()" might be better (assuming it works with our component)
https://playwright.dev/docs/input#checkboxes-and-radio-buttons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this might be impossible if we haven't properly made it accessible. But worth checking out (no pun intended)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can check on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3537a14
Found this solution, what do you think? there are 4 places that updates when something gets checked.
tds-dropdown-option get aria-selected
tds-checkbox gets the checked
input gets the aria-checked
and the dropdown value becomes updates with all checked values...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I think that works. I believe it always needs the aria-selected attribute since they can never be just native checkboxes.
Lets go with this if you agree 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool sounds cool with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
* chore(dropdown): wip unit tests for no-result-text * test(dropdown): added tests * test(dropdown): updated tests after meeting to follow standards * test(dropdown): update so that label outside test work with also helpertext * test(dropdown): add some screenshot testing and update some test names * test(dropdown): update test to not use implementation details * test(dropdown): test correctly * test(dropdown): new tests for dropdown multiselect * test(dropdown): update all tests to have less implementation details * test(dropdown): update dropdown to use hidden and add basic dropdown * test(dropdown): update tests to be less implementation detail oriented --------- Co-authored-by: Default <alex.john.eneroth@gmail.om>
* test(button): added unit tests (#433) * feat(button): add unit tests for basic and disabled button * test: button tests to check for colors and other things to find a good pattern * test: adding more tests for more test cases in button * test: small update to button tests * test: make sure disabled button has the correct cursor when disabled test * fix: update pr with button without text and icon and check for width * chore(all tests): update to componentTestPath instead of componentName * test(button): update test text to be correct after pr comment * test(button): update small text --------- Co-authored-by: Lindqvist Nathalie <nathalie.lindqvist@scania.com> * test(message): added unit tests (#437) * test(message): added unit tests * fix: review update * test(button): refactor unit tests (#440) * test(button): updates all tests for less implementation details * test(button): update to better reflect how we should test * test(button): remove id from index on tests since its not used * test(dropdown): added unit tests (#435) * chore(dropdown): wip unit tests for no-result-text * test(dropdown): added tests * test(dropdown): updated tests after meeting to follow standards * test(dropdown): update so that label outside test work with also helpertext * test(dropdown): add some screenshot testing and update some test names * test(dropdown): update test to not use implementation details * test(dropdown): test correctly * test(dropdown): new tests for dropdown multiselect * test(dropdown): update all tests to have less implementation details * test(dropdown): update dropdown to use hidden and add basic dropdown * test(dropdown): update tests to be less implementation detail oriented --------- Co-authored-by: Default <alex.john.eneroth@gmail.om> * fix(chip): double click for radio type (#441) * fix(chip): set checked to true for radio * fix: mutable for checked prop * fix: throw error instead of warning * build(deps-dev): bump @adobe/css-tools in /packages/angular Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.3.1 to 4.3.2. - [Changelog](https://github.com/adobe/css-tools/blob/main/History.md) - [Commits](https://github.com/adobe/css-tools/commits) --- updated-dependencies: - dependency-name: "@adobe/css-tools" dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * test(textarea): added unit tests (#436) * test(textarea): adding unit tests * test(textarea): remove hydrated class check from tests * test(textarea): update tests with some comments on all the expect * test(textarea): update check on component to be truthy * test(textarea): update after pr comments * test(textarea): remove test for filling or clicking readonly textarea since it does not work * test(textarea): updates after reading article * test(textarea): added basic test and also update test to use getByRole * test(textarea): added screenshot for when adding text to textarea * test(textarea): add tests for label and update some screenshot names * fix(popover-core): show prop read on an initial load (#439) * fix(textarea): remove only on tests read-only textarea (#443) * test(table): added unit tests (#438) * test(table): added unit tests * test(table): added a bunch more unit tests * test(table): change toBeTruthy to toHaveCount instead * test(table): update all tests to follow less implementation details * test(table): update tests to reflect hidden * chore: typo correction just to trigger SonarCloud * test(table): rename basic to default * test(table): update name of test in multiselect --------- Co-authored-by: theJohnnyMe <nikola.johnny.mirkovic@scania.com> * fix(css): headline-05 updated to correct value (#445) * fix(css): headline-05 updated to correct value * fix(headline-05): updated typography in tegel * fix(message): updated storybook to now have two mode-variant (#446) * feat(dropdown): added support for normalized text when searching (#444) * feat(dropdown): added support for normalized text when searching * test(dropdown): move some files around * fix(dropdown: filter): line height increase --------- Co-authored-by: theJohnnyMe <nikola.johnny.mirkovic@scania.com> * docs(table): added tds-table-body to the filtering and pagination (#447) * feat(css): update from rem to px on utility classes (#448) * Release of @scania/tegel@1.3.2 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Alfred Skedebäck <alfred.skedeback@umain.com> Co-authored-by: Lindqvist Nathalie <nathalie.lindqvist@scania.com> Co-authored-by: theJohnnyMe <nikola.johnny.mirkovic@scania.com> Co-authored-by: Default <alex.john.eneroth@gmail.om> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: theJohnnyMe <theJohnnyMe@users.noreply.github.com>
Describe pull-request
Followed the test steps in ticket/excel to test.
Solving issue
Fixes: CDEP-2960
How to test
npm run test
in core to run the tests. Make sure they run.Additional context
We are still in exploration for good testing.