aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-16 19:37:01 -0500
committerGitHub <noreply@github.com>2024-02-17 00:37:01 +0000
commit4e77741d22778bd09b772fc53f1cbd64107e3d24 (patch)
treee8010d42ccba5341afd98177d3c1d69d856cbcbd /test
parent1e69210b53151f31140bb1fbdc9f3d71fa181630 (diff)
Even more eslint rules (#696)
* capitalized-comments * Turn rules on * Add miscellaneous rules * More rules
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/dom-test.js1
-rw-r--r--test/language-transformer.test.js3
-rw-r--r--test/options-util.test.js14
-rw-r--r--test/playwright/integration.spec.js4
-rw-r--r--test/playwright/playwright-util.js2
-rw-r--r--test/playwright/visual.spec.js12
-rw-r--r--test/profile-conditions-util.test.js4
-rw-r--r--test/utilities/translator.js1
8 files changed, 21 insertions, 20 deletions
diff --git a/test/fixtures/dom-test.js b/test/fixtures/dom-test.js
index 578b1324..961e0a77 100644
--- a/test/fixtures/dom-test.js
+++ b/test/fixtures/dom-test.js
@@ -28,6 +28,7 @@ function prepareWindow(window) {
// Define innerText setter as an alias for textContent setter
Object.defineProperty(window.HTMLDivElement.prototype, 'innerText', {
+ get() { return this.textContent; },
set(value) { this.textContent = value; }
});
diff --git a/test/language-transformer.test.js b/test/language-transformer.test.js
index 0c8ef08d..7c0da48b 100644
--- a/test/language-transformer.test.js
+++ b/test/language-transformer.test.js
@@ -923,7 +923,7 @@ describe('LanguageTransformer', () => {
{term: 'あかい', source: 'あけえ', rule: 'adj-i', reasons: ['-e']},
{term: 'こわい', source: 'こええ', rule: 'adj-i', reasons: ['-e']},
{term: 'つよい', source: 'つええ', rule: 'adj-i', reasons: ['-e']},
- // small -e
+ // Small -e
{term: 'すごい', source: 'すげぇ', rule: 'adj-i', reasons: ['-e']},
{term: 'やばい', source: 'やべぇ', rule: 'adj-i', reasons: ['-e']},
{term: 'うるさい', source: 'うるせぇ', rule: 'adj-i', reasons: ['-e']},
@@ -1152,7 +1152,6 @@ describe('LanguageTransformer', () => {
languageTransformer.addDescriptor(descriptor);
describe('deinflections', () => {
- // for (const {valid, tests} of data) {
describe.each(data)('$category', ({valid, tests}) => {
for (const {source, term, rule, reasons} of tests) {
const {has} = hasTermReasons(languageTransformer, source, term, rule, reasons);
diff --git a/test/options-util.test.js b/test/options-util.test.js
index a178aecb..3a1b1efb 100644
--- a/test/options-util.test.js
+++ b/test/options-util.test.js
@@ -702,7 +702,7 @@ describe('OptionsUtil', () => {
const match = fileNameRegex.exec(fileName);
if (match !== null) {
updates.push({
- version: Number.parseInt(match[1]),
+ version: Number.parseInt(match[1], 10),
changes: loadDataFile(path.join(templatesDirPath, match[0]))
});
}
@@ -846,7 +846,7 @@ describe('OptionsUtil', () => {
{{~> (lookup . "marker") ~}}
`.trimStart()
},
- // glossary and glossary-brief update
+ // Glossary and glossary-brief update
{
oldVersion: 7,
newVersion: 12,
@@ -1238,7 +1238,7 @@ describe('OptionsUtil', () => {
<<<UPDATE-ADDITIONS>>>
{{~> (lookup . "marker") ~}}`.trimStart()
},
- // block helper update: furigana and furiganaPlain
+ // Block helper update: furigana and furiganaPlain
{
oldVersion: 20,
newVersion: 21,
@@ -1326,7 +1326,7 @@ describe('OptionsUtil', () => {
{{~> (lookup . "marker") ~}}`.trimStart()
},
- // block helper update: formatGlossary
+ // Block helper update: formatGlossary
{
oldVersion: 20,
newVersion: 21,
@@ -1400,7 +1400,7 @@ describe('OptionsUtil', () => {
{{~> (lookup . "marker") ~}}`.trimStart()
},
- // block helper update: set and get
+ // Block helper update: set and get
{
oldVersion: 20,
newVersion: 21,
@@ -1502,7 +1502,7 @@ describe('OptionsUtil', () => {
{{~> (lookup . "marker") ~}}`.trimStart()
},
- // block helper update: hasMedia and getMedia
+ // Block helper update: hasMedia and getMedia
{
oldVersion: 20,
newVersion: 21,
@@ -1584,7 +1584,7 @@ describe('OptionsUtil', () => {
{{~> (lookup . "marker") ~}}`.trimStart()
},
- // block helper update: pronunciation
+ // Block helper update: pronunciation
{
oldVersion: 20,
newVersion: 21,
diff --git a/test/playwright/integration.spec.js b/test/playwright/integration.spec.js
index 170714a1..06af3fd2 100644
--- a/test/playwright/integration.spec.js
+++ b/test/playwright/integration.spec.js
@@ -31,13 +31,13 @@ import {
test.beforeEach(async ({context}) => {
// Wait for the on-install welcome.html tab to load, which becomes the foreground tab
const welcome = await context.waitForEvent('page');
- await welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
+ await welcome.close(); // Close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
});
test('search clipboard', async ({page, extensionId}) => {
await page.goto(`chrome-extension://${extensionId}/search.html`);
await page.locator('#search-option-clipboard-monitor-container > label').click();
- await page.waitForTimeout(200); // race
+ await page.waitForTimeout(200); // Race
await writeToClipboardFromPage(page, 'あ');
await expect(page.locator('#search-textbox')).toHaveValue('あ');
diff --git a/test/playwright/playwright-util.js b/test/playwright/playwright-util.js
index b364c80b..b9a4831a 100644
--- a/test/playwright/playwright-util.js
+++ b/test/playwright/playwright-util.js
@@ -28,7 +28,7 @@ export const test = base.extend({
context: async ({}, use) => {
const pathToExtension = path.join(root, 'ext');
const context = await chromium.launchPersistentContext('', {
- // headless: false,
+ // Disabled: headless: false,
args: [
'--headless=new',
`--disable-extensions-except=${pathToExtension}`,
diff --git a/test/playwright/visual.spec.js b/test/playwright/visual.spec.js
index fc8bb8df..157cedc7 100644
--- a/test/playwright/visual.spec.js
+++ b/test/playwright/visual.spec.js
@@ -22,7 +22,7 @@ import {expect, root, test} from './playwright-util.js';
test.beforeEach(async ({context}) => {
// Wait for the on-install welcome.html tab to load, which becomes the foreground tab
const welcome = await context.waitForEvent('page');
- welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
+ welcome.close(); // Close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
});
test('visual', async ({page, extensionId}) => {
@@ -63,9 +63,9 @@ test('visual', async ({page, extensionId}) => {
if (typeof popup_frame === 'undefined') {
frame_attached = page.waitForEvent('frameattached');
}
- await page.mouse.move(box.x + offset.x, box.y + offset.y, {steps: 10}); // hover over the test
+ await page.mouse.move(box.x + offset.x, box.y + offset.y, {steps: 10}); // Hover over the test
if (typeof popup_frame === 'undefined') {
- popup_frame = await frame_attached; // wait for popup to be attached
+ popup_frame = await frame_attached; // Wait for popup to be attached
}
try {
// Some tests don't have a popup, so don't fail if it's not there
@@ -75,11 +75,11 @@ test('visual', async ({page, extensionId}) => {
console.log(test_name + ' has no popup');
}
- await page.bringToFront(); // bring the page to the foreground so the screenshot doesn't hang; for some reason the frames result in page being in the background
+ await page.bringToFront(); // Bring the page to the foreground so the screenshot doesn't hang; for some reason the frames result in page being in the background
await expect.soft(page).toHaveScreenshot(test_name + '.png');
- await page.mouse.click(0, 0); // click away so popup disappears
- await (await /** @type {import('@playwright/test').Frame} */ (popup_frame).frameElement()).waitForElementState('hidden'); // wait for popup to disappear
+ await page.mouse.click(0, 0); // Click away so popup disappears
+ await (await /** @type {import('@playwright/test').Frame} */ (popup_frame).frameElement()).waitForElementState('hidden'); // Wait for popup to disappear
};
// Test document 1
diff --git a/test/profile-conditions-util.test.js b/test/profile-conditions-util.test.js
index 6de5ad1d..590e5873 100644
--- a/test/profile-conditions-util.test.js
+++ b/test/profile-conditions-util.test.js
@@ -250,7 +250,7 @@ describe('Profile conditions utilities', () => {
]
},
- // url tests
+ // Url tests
{
conditionGroups: [
{
@@ -606,7 +606,7 @@ describe('Profile conditions utilities', () => {
]
},
- // flags tests
+ // Flags tests
{
conditionGroups: [
{
diff --git a/test/utilities/translator.js b/test/utilities/translator.js
index b77bfb39..f452e688 100644
--- a/test/utilities/translator.js
+++ b/test/utilities/translator.js
@@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+// eslint-disable-next-line no-template-curly-in-string
const placeholder = '${title}';
/**