From d928589a70a2c14d2845ac81863c6f6f56eade1c Mon Sep 17 00:00:00 2001 From: m-akinc <7282195+m-akinc@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:02:59 -0500 Subject: [PATCH 1/5] Change select test to use IntersectionObserver (#590) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## ๐Ÿคจ Rationale IntersectionObserver provides a less brittle way for us to test that the select listbox is fully visible within the viewport. ## ๐Ÿ‘ฉโ€๐Ÿ’ป Implementation Created an IntersectionObserver with a callback that sets a flag if the listbox intersects fully with the viewport. The test clicks the select, waits for rendering (actually just two DOM updates), then asserts that our callback has set the flag. ## ๐Ÿงช Testing Test passes ## โœ… Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --- ...-189fc165-f9ed-4054-adf4-14e7b57b34c4.json | 7 +++ .../src/select/tests/select.spec.ts | 55 +++++++++++++------ 2 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 change/@ni-nimble-components-189fc165-f9ed-4054-adf4-14e7b57b34c4.json diff --git a/change/@ni-nimble-components-189fc165-f9ed-4054-adf4-14e7b57b34c4.json b/change/@ni-nimble-components-189fc165-f9ed-4054-adf4-14e7b57b34c4.json new file mode 100644 index 0000000000..4dba31800b --- /dev/null +++ b/change/@ni-nimble-components-189fc165-f9ed-4054-adf4-14e7b57b34c4.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Change test to use IntersectionObserver", + "packageName": "@ni/nimble-components", + "email": "7282195+m-akinc@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/packages/nimble-components/src/select/tests/select.spec.ts b/packages/nimble-components/src/select/tests/select.spec.ts index 52564ab521..5ed90da457 100644 --- a/packages/nimble-components/src/select/tests/select.spec.ts +++ b/packages/nimble-components/src/select/tests/select.spec.ts @@ -24,6 +24,33 @@ async function setup( return fixture