mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-18 09:06:53 +03:00
Fix Firefox DevTools extension paths (#231)
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
|
||||
chrome.devtools.panels.create(
|
||||
'Impeccable',
|
||||
'icons/icon-32.png',
|
||||
'devtools/panel.html'
|
||||
'/icons/icon-32.png',
|
||||
'/devtools/panel.html'
|
||||
);
|
||||
|
||||
// Sidebar pane in the Elements panel: shows findings for the currently selected element
|
||||
chrome.devtools.panels.elements.createSidebarPane('Impeccable', (sidebar) => {
|
||||
sidebar.setPage('devtools/sidebar.html');
|
||||
sidebar.setPage('/devtools/sidebar.html');
|
||||
sidebar.setHeight('200px');
|
||||
});
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export const SUITES = {
|
||||
/^extension\/(background|content|detector|devtools|popup|manifest\.json)/,
|
||||
/^scripts\/(benchmark-detector|build-browser-detector|build-extension)\.js$/,
|
||||
/^site\/(pages\/detector|public\/antipattern|data\/anti-patterns-catalog\.js)/,
|
||||
/^tests\/(detect-antipatterns|fixtures\/antipatterns)/,
|
||||
/^tests\/(detect-antipatterns|extension-build|fixtures\/antipatterns)/,
|
||||
],
|
||||
commands: [
|
||||
{
|
||||
@@ -81,6 +81,7 @@ export const SUITES = {
|
||||
{
|
||||
runner: 'node',
|
||||
files: [
|
||||
'tests/extension-build.test.mjs',
|
||||
'tests/detect-antipatterns-fixtures.test.mjs',
|
||||
'tests/detect-antipatterns-browser.test.mjs',
|
||||
],
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import path from 'node:path';
|
||||
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
describe('extension DevTools packaging', () => {
|
||||
it('uses extension-root paths for DevTools panel pages', () => {
|
||||
const source = readFileSync(path.join(ROOT, 'extension/devtools/devtools.js'), 'utf-8');
|
||||
|
||||
assert.match(
|
||||
source,
|
||||
/chrome\.devtools\.panels\.create\(\s*['"]Impeccable['"],\s*['"]\/icons\/icon-32\.png['"],\s*['"]\/devtools\/panel\.html['"]\s*\)/s,
|
||||
'Firefox resolves DevTools URLs relative to devtools.html unless they start at the extension root',
|
||||
);
|
||||
assert.match(source, /sidebar\.setPage\(['"]\/devtools\/sidebar\.html['"]\)/);
|
||||
assert.doesNotMatch(source, /['"]devtools\/(?:panel|sidebar)\.html['"]/);
|
||||
assert.doesNotMatch(source, /['"]icons\/icon-32\.png['"]/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user