Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Scripts/AutomatedEventsScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function attributes(): array
return array_filter([
'data-collect' => Setting::get(SettingName::EVENT_COLLECT_DOWNLOADS),
'data-extensions' => Setting::get(SettingName::EVENT_EXTENSIONS),
'data-use-title' => Setting::get(SettingName::EVENT_USE_TITLE),
'data-full-urls' => Setting::get(SettingName::EVENT_FULL_URLS),
'data-use-title' => Setting::boolean(SettingName::EVENT_USE_TITLE) ? 'true' : 'false',
'data-full-urls' => Setting::boolean(SettingName::EVENT_FULL_URLS) ? 'true' : 'false',
'data-sa-global' => Setting::get(SettingName::EVENT_SA_GLOBAL),
]);
}
Expand Down
14 changes: 12 additions & 2 deletions tests/Browser/pluginSettings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ test('adds automated events script with use titles of page enabled', async ({ pa
await expect(page.locator('[name="simpleanalytics_event_use_title"]')).toBeChecked();

const guest = await visitAsGuest(browser);
expect(await guest.content()).toContain('data-use-title');
const eventsScript = guest.locator('script[src="https://scripts.simpleanalyticscdn.com/auto-events.js"]');
await expect(eventsScript).toHaveAttribute('data-use-title', 'true');
await page.locator('[name="simpleanalytics_event_use_title"]').uncheck();
await saveSettings(page);
await guest.reload();
await expect(eventsScript).toHaveAttribute('data-use-title', 'false');
await guest.context().close();
});

Expand All @@ -272,7 +277,12 @@ test('adds automated events script with use full urls enabled', async ({ page, b
await expect(page.locator('[name="simpleanalytics_event_full_urls"]')).toBeChecked();

const guest = await visitAsGuest(browser);
expect(await guest.content()).toContain('data-full-urls');
const eventsScript = guest.locator('script[src="https://scripts.simpleanalyticscdn.com/auto-events.js"]');
await expect(eventsScript).toHaveAttribute('data-full-urls', 'true');
await page.locator('[name="simpleanalytics_event_full_urls"]').uncheck();
await saveSettings(page);
await guest.reload();
await expect(eventsScript).toHaveAttribute('data-full-urls', 'false');
await guest.context().close();
});

Expand Down