Skip to content

Commit

Permalink
fix selectors in test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Oct 17, 2024
1 parent 08bbaa1 commit 7e3ea00
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have the expected <script> tag in the <head>', function() {
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));

expect(scriptTags.length).to.be.equal(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Build Greenwood With: ', function() {

describe('<script> tags and files', function() {
it('should contain three <script> tags in the <head>', function() {
const allScriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
const allScriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));

expect(allScriptTags.length).to.be.equal(3);
});
Expand All @@ -92,7 +92,7 @@ describe('Build Greenwood With: ', function() {
// assume the first tag is for the header
describe('Header', function() {
it('should contain one <script> tag with the expected JS content inlined of type="module" for the header', function() {
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'))[0];
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'))[0];

expect(scriptTag.type).to.be.equal('module');
// eslint-disable-next-line max-len
Expand All @@ -104,7 +104,7 @@ describe('Build Greenwood With: ', function() {
// https://github.com/ProjectEvergreen/greenwood/issues/656
describe('Foobar', function() {
it('should contain one <script> tag with the expected JS content inlined of type="module" for FooBar', function() {
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'))[1];
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'))[1];

// eslint-disable-next-line max-len
expect(scriptTag.textContent).to.contain('class t extends HTMLElement{constructor(){super(),this.list=[]}find(t){this.list.findIndex((e=>new RegExp(`^${t}$`).test(e.route)))}}export{t as Foobar};');
Expand All @@ -115,7 +115,7 @@ describe('Build Greenwood With: ', function() {
// https://github.com/ProjectEvergreen/greenwood/issues/656
describe('Baz', function() {
it('should contain one <script> tag with the expected JS content for the already inlined of type="module" for Baz', function() {
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'))[2];
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'))[2];

expect(scriptTag.type).to.be.equal('module');
// eslint-disable-next-line max-len
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have the expected <script> tag in the <head>', function() {
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));

expect(scriptTags.length).to.be.equal(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have one <script> tag in the <head>', function() {
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));

expect(scriptTags.length).to.be.equal(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have no <script> tags in the <head>', function() {
const scriptTags = dom.window.document.querySelectorAll('head script[type="module"');
const scriptTags = dom.window.document.querySelectorAll('head script[type="module"]');

expect(scriptTags.length).to.be.equal(0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Build Greenwood With: ', function() {
});

before(function() {
scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));
linkTags = dom.window.document.querySelectorAll('head > link[rel="stylesheet"');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Build Greenwood With: ', function() {
let styleTags;

before(function() {
scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));
linkTags = dom.window.document.querySelectorAll('head > link[rel="stylesheet"');
styleTags = dom.window.document.querySelectorAll('head > style');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Build Greenwood With: ', function() {
let styleTags;

before(function() {
scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));
linkTags = dom.window.document.querySelectorAll('head > link[rel="stylesheet"]');
styleTags = dom.window.document.querySelectorAll('head > style');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have one <script> tags in the <head>', async function() {
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));

expect(scriptTags.length).to.be.equal(1);
});
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have one <script> tags in the <head>', async function() {
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"')).filter(tag => !tag.getAttribute('data-gwd'));
const scriptTags = Array.from(dom.window.document.querySelectorAll('head script[type="module"]')).filter(tag => !tag.getAttribute('data-gwd'));

expect(scriptTags.length).to.be.equal(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Build Greenwood With: ', function() {
});

it('should have expected link tag in the head', function() {
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"'))
const scriptTag = Array.from(dom.window.document.querySelectorAll('head script[type="module"]'))
.filter((tag) => !tag.getAttribute('data-gwd'))
.filter((tag) => tag.getAttribute('src').indexOf('/greeting.') === 0);

Expand Down

0 comments on commit 7e3ea00

Please sign in to comment.