Skip to content

Commit

Permalink
updated .eslintignore & svelte-styles-csptest index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
DrCBeatz committed Oct 3, 2021
1 parent fa56460 commit 314402b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
**/expected.js
_output
test/*/samples/*/output.js
test/svelte-styles-csp/*.js
test/svelte-styles-csp/svelte-test-transitions-no-styles-csp/build/*.js
test/svelte-styles-csp/svelte-test-transitions-styles-csp/build/*.js

# automatically generated
internal_exports.ts
Expand Down
38 changes: 19 additions & 19 deletions test/svelte-styles-csp/index.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
const puppeteer = require("puppeteer");
import * as assert from "assert";
const path = require("path");
const puppeteer = require('puppeteer');
import * as assert from 'assert';
const path = require('path');

// set to false to view transitions tested in Chromium
const headless_browser = true;

describe("svelte-style-csp", async () => {
describe("test transitions with svelte-styles-csp & strict-CSP", async () => {
it("svelte-stylesheet loaded and transitions work", async () => {
describe('svelte-style-csp', async () => {
describe('test transitions with svelte-styles-csp & strict-CSP', async () => {
it('svelte-stylesheet loaded and transitions work', async () => {
const absolutePath = path.join(
__dirname,
"svelte-test-transitions-styles-csp/index.html"
'svelte-test-transitions-styles-csp/index.html'
);
const browser = await puppeteer.launch({ headless: headless_browser });
const page = await browser.newPage();
try {
await page.goto("file://" + absolutePath);
await page.goto('file://' + absolutePath);
await page.waitFor(1000);
let linkTitle: string;
// look for title attribute in link tags to
const linkTitles = await page.evaluateHandle(() => {
return Array.from(document.getElementsByTagName("link")).map(
return Array.from(document.getElementsByTagName('link')).map(
(a) => a.title
);
});
const linkList = await linkTitles.jsonValue();

for (const item of linkList) {
if (item == "svelte-stylesheet") linkTitle = item;
if (item == 'svelte-stylesheet') linkTitle = item;
}

await page.click("input");
await page.click('input');
await page.waitFor(1000);
await page.click("input");
await page.click('input');
await page.waitFor(1000);
await browser.close();
assert.equal(linkTitle, "svelte-stylesheet");
assert.equal(linkTitle, 'svelte-stylesheet');
} catch (err) {
throw new Error(err);
}
}).timeout(10000);
});

describe("test transitions without svelte-styles-csp & strict CSP", async () => {
it("transitions fail with strict CSP and no stylesrc: unsafe-iline", async () => {
describe('test transitions without svelte-styles-csp & strict CSP', async () => {
it('transitions fail with strict CSP and no stylesrc: unsafe-iline', async () => {
const absolutePath = path.join(
__dirname,
"svelte-test-transitions-no-styles-csp/index.html"
'svelte-test-transitions-no-styles-csp/index.html'
);
const browser = await puppeteer.launch({ headless: headless_browser });
const page = await browser.newPage();
try {
await page.goto("file://" + absolutePath);
await page.goto('file://' + absolutePath);
await page.waitFor(1000);
await page.click("input");
await page.click('input');
await page.waitFor(1000);
await page.click("input");
await page.click('input');
await page.waitFor(1000);
await browser.close();
} catch (err) {
Expand Down

0 comments on commit 314402b

Please sign in to comment.