Skip to content
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

US152268 - Migrate dialog-confirm and dialog-ifrau vdiff tests #3935

Merged
merged 5 commits into from
Aug 28, 2023

Conversation

svanherk
Copy link
Contributor

@svanherk svanherk commented Aug 28, 2023

Like the previously migrated dialog tests, I've turned off the native tests for now.

FYI @grant-cleary since you know more about the ifrau tests.

Final report: https://vdiff.d2l.dev/BrightspaceUI/core/5d76917d6b2e6eeec4a851c6bbbabe9f8e975f5a/2023-08-28_19-00-54/report/

@svanherk svanherk requested a review from a team as a code owner August 28, 2023 17:27
@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-3935/

Note
The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

Copy link
Contributor

@grant-cleary grant-cleary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brings me back. ifrau bits look good to me.

@@ -18,24 +18,13 @@
<body class="d2l-typography">
<d2l-button id="open">Open Dialog</d2l-button>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this d2l-button here since this test requires a whole html file anyways, but I can remove it if we want to be consistent with the look of the other tests. Left in, the dialog-ifrau tests result in no diffs 🎉

<script>
const dialog = document.getElementById('ifrau-dialog');
dialog.addEventListener('d2l-dialog-open', () => {
window.parent.postMessage('ifrau-dialog-open', '*');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these postMessage values no longer being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they were used to open the dialog (and then close it in reset for the next test). Now that the tests are isolated I can just start with the dialog opened. But if we want to test this functionality, I could add it back, or maybe just a dedicated test for opening and one for closing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Makes sense.

`;

const confirmDialog = html`
<d2l-dialog-confirm id="confirm" title-text="Title" text="Are you sure?" opened>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting up by using opened attribute is definitely much cleaner, which is great. I think the helper was implicitly also testing the d2l-dialog-open & d2l-dialog-close events. I think the open event may still be covered by some unit tests (also implicitly), but I'm not sure the close event is covered. I'm wondering if it would be a good idea for us to add an explicit unit test for those events, since consumers do rely on them. Or maybe you already checked and found they are covered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'd say that's kinda covered by the dialog-mixin.vdiff.js tests. But I like the idea of adding non-vdiff, dedicated tests - I'll add some to this PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do, I'm thinking those unit tests should be for the general mixin case.

Copy link
Contributor Author

@svanherk svanherk Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, just pushed a new file - it'll fail until we expose oneDefaultPreventedEvent in @brightspace-ui/testing, but is that what you had in mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, merged the change in @brightspace-ui/testing and now CI here is passing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, exactly. Looks great!

Copy link
Member

@dlockhart dlockhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, love how clean these migrations are.

@svanherk svanherk merged commit 00cc39a into main Aug 28, 2023
6 checks passed
@svanherk svanherk deleted the US152268_rest_of_dialog_vdiffs branch August 28, 2023 21:17
@ghost
Copy link

ghost commented Aug 29, 2023

🎉 This PR is included in version 2.141.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants