MCPcopy Index your code
hub / github.com/zxlie/FeHelper / loadTransColorApp

Function loadTransColorApp

test/trans-color-hex-input.test.js:6–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { describe, expect, it } from 'vitest';
5
6function loadTransColorApp() {
7 const source = fs.readFileSync(path.resolve('apps/trans-color/index.js'), 'utf8');
8 let options;
9
10 vm.runInNewContext(source, {
11 Vue: function Vue(config) {
12 options = config;
13 },
14 chrome: {
15 runtime: {
16 sendMessage: () => {}
17 }
18 },
19 document: {
20 createElement: () => ({ textContent: '' }),
21 head: { appendChild: () => {} }
22 },
23 console
24 });
25
26 const app = JSON.parse(JSON.stringify(options.data));
27 Object.keys(options.methods).forEach(methodName => {
28 app[methodName] = options.methods[methodName].bind(app);
29 });
30
31 return app;
32}
33
34describe('trans-color HEX input regression guards', () => {
35 it('does not normalize the actively edited HEX input on every keypress', () => {

Callers 1

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected