Skip to content

Commit 36a8ef6

Browse files
committed
fix conflict
2 parents 984357d + 536aae1 commit 36a8ef6

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

capture_zoom.png

42.1 KB
Loading

dist.zip

7.6 KB
Binary file not shown.

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Screenshot
66

7-
![Screenshot](./capture.png)
7+
![Screenshot1](./capture.png)
88

99
## Installation
1010

test/view.spec.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* eslint-env mocha */
2+
const expect = require('chai').expect;
3+
const View = require('../src/view.js');
4+
const Model = require('../src/model.js');
5+
6+
describe('View >', () => {
7+
const range = 'm3';
8+
9+
it('CreateElement', () => {
10+
const dom = View.CreateElement();
11+
const nodes = dom.childNodes;
12+
13+
expect(nodes[0].nodeName).to.equal('SPAN');
14+
expect(nodes[7].nodeName).to.equal('SPAN');
15+
16+
for (let i = 0; i < Model.TERM.length; ++i) {
17+
const key = i + 1;
18+
expect(nodes[key].nodeName).to.equal('A');
19+
expect(nodes[key].textContent).to.equal(Model.TERM[i].text);
20+
expect(nodes[key].getAttribute('data')).to.equal(Model.TERM[i].data);
21+
}
22+
});
23+
24+
it('BindElement', () => {
25+
const dom = View.CreateElement();
26+
View.BindElement(dom);
27+
const target = document.querySelector('div#ucs > .quick-custom-gsearch');
28+
expect(target.nodeName).to.equal('DIV');
29+
});
30+
31+
it('SetCssState', () => {
32+
View.SetCssState(range);
33+
const target = document.querySelector(`.quick-custom-gsearch a[data=${range}]`);
34+
expect(target.className).to.equal('active');
35+
});
36+
37+
it('QuickChange', () => {
38+
const elm = document.createElement('a');
39+
elm.setAttribute('data', Model.TERM[0].data);
40+
elm.appendChild(document.createTextNode(Model.TERM[0].text));
41+
const event = View.QuickChange.bind(elm);
42+
const result = event();
43+
expect(result).to.equal('/search?hl=ja&site=webhp&biw=810&bih=1306&q=duckduckgo&oq=duckduckgo&ie=UTF-8&tbm=');
44+
});
45+
});

0 commit comments

Comments
 (0)