Skip to content

Commit

Permalink
Add integration test for clicks on button children
Browse files Browse the repository at this point in the history
  • Loading branch information
jethron committed Jan 10, 2024
1 parent a377d94 commit a7d7aaf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/javascript-tracker",
"comment": "",
"type": "none"
}
],
"packageName": "@snowplow/javascript-tracker"
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ describe('Snowplow Micro integration', () => {
await (await $('#button7')).click();
await browser.pause(500);

// Nested child
await (await $('#button-child')).click();
await browser.pause(500);

// Disable/enable

await (await $('#disable')).click();
Expand Down Expand Up @@ -131,6 +135,11 @@ describe('Snowplow Micro integration', () => {
logContainsButtonClick(ev);
});

it('should get button when click was on a child element', async () => {
const ev = makeEvent({ label: 'TestChildren' }, method);
logContainsButtonClick(ev);
});

it('should not get disabled-click', () => {
const ev = makeEvent({ id: 'disabled-click', label: 'DisabledClick' }, method);
expect(logContains(ev)).toBe(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<!-- A button that adds a new button dynamically -->
<button id="addDynamic" onclick="addDynamicButton()">AddButton</button>

<!-- Ensure button tracked when children are clicked -->
<button><span id="button-child">TestChildren</span></button>

<!-- Enable/disable testing -->
<button id="disable" onclick="snowplow('disableButtonClickTracking')">Disable</button>
<button id="disabled-click">DisabledClick</button>
Expand Down

0 comments on commit a7d7aaf

Please sign in to comment.