Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Commit 0dc3d6a

Browse files
committed
feat: use DTL in the console
1 parent 9a15410 commit 0dc3d6a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"scripts": ["dist/background.js"],
1515
"persistent": false
1616
},
17+
"web_accessible_resources": [
18+
"node_modules/@testing-library/dom/dist/@testing-library/dom.umd.min.js"
19+
],
1720
"content_scripts": [
1821
{
1922
"matches": ["<all_urls>"],

src/contentScript.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,14 @@ function showElement(el) {
5757
}
5858

5959
window.showElement = showElement;
60+
61+
const scriptTag = document.createElement("script");
62+
// TODO: add "script.js" to web_accessible_resources in manifest.json
63+
scriptTag.src = chrome.runtime.getURL(
64+
"node_modules/@testing-library/dom/dist/@testing-library/dom.umd.min.js"
65+
);
66+
// eslint-disable-next-line func-names
67+
scriptTag.onload = function () {
68+
this.remove();
69+
};
70+
(document.head || document.documentElement).appendChild(scriptTag);

0 commit comments

Comments
 (0)