Skip to content

Commit 2ef5ed3

Browse files
authored
🏗 Auto-format dev dashboard tests (#34546)
1 parent 1f0bef9 commit 2ef5ed3

8 files changed

Lines changed: 227 additions & 234 deletions

File tree

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ validator/export
3030
# Files and directories explicitly ignored by eslint
3131
build-system/babel-plugins/**/fixtures/**/*.js
3232
build-system/babel-plugins/**/fixtures/**/*.mjs
33-
build-system/server/app-index/test/*.js
3433
build-system/tasks/make-extension/template/**/*
3534
build-system/tasks/visual-diff/snippets/*.js
3635
extensions/amp-a4a/0.1/test/testdata/**

build-system/server/app-index/test/helpers.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
const {expect} = require('chai');
1818
const {JSDOM} = require('jsdom');
1919

20-
21-
const parseHtmlChunk = htmlStr => {
22-
const {body} = (new JSDOM(htmlStr)).window.document;
20+
const parseHtmlChunk = (htmlStr) => {
21+
const {body} = new JSDOM(htmlStr).window.document;
2322
expect(body.children).to.have.length(1);
2423
return body.firstElementChild;
2524
};
2625

27-
28-
const boundAttrRe = attr =>
26+
const boundAttrRe = (attr) =>
2927
new RegExp(`\\[${attr}\\]=(("[^"]+")|('[^']+')|([^\\s\\>]+))`);
3028

31-
3229
// JSDom doesn't parse attributes whose names don't follow the spec, so
3330
// our only way to test [attr] values is via regex.
3431
const getBoundAttr = ({outerHTML}, attr) => {
@@ -37,13 +34,11 @@ const getBoundAttr = ({outerHTML}, attr) => {
3734
return;
3835
}
3936
const [, valuePart] = match;
40-
if (valuePart.charAt(0) == '"' ||
41-
valuePart.charAt(0) == '\'') {
37+
if (valuePart.charAt(0) == '"' || valuePart.charAt(0) == "'") {
4238
return valuePart.substring(1, valuePart.length - 1);
4339
}
4440
return valuePart;
45-
}
46-
41+
};
4742

4843
const expectValidAmphtml = (validator, string) => {
4944
const {errors: errorsAndWarnings, status} = validator.validateString(string);
@@ -55,7 +50,6 @@ const expectValidAmphtml = (validator, string) => {
5550
expect(status).to.equal('PASS');
5651
};
5752

58-
5953
module.exports = {
6054
expectValidAmphtml,
6155
getBoundAttr,

0 commit comments

Comments
 (0)