Skip to content

Commit c1a32e7

Browse files
committed
test: load(css)
1 parent 2f619ae commit c1a32e7

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

test/load/css.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.button {
2+
width: 100px;
3+
}

test/load/loadcss.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import bbo from '../bbo';
2+
3+
describe('loadcss', () => {
4+
test('bbo.loadcss() is a Function', () => {
5+
expect(bbo.loadcss).toBeInstanceOf(Function);
6+
});
7+
8+
test('bbo.loadcss()', () => {
9+
const button = bbo.c('button', 'button', 'click me', 'idName');
10+
document.body.appendChild(button);
11+
bbo.loadcss('./css.css', () => {
12+
expect(button.offsetWidth).toEqual('100px');
13+
});
14+
});
15+
});

test/load/loadjs.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import bbo from '../bbo';
2+
3+
describe('loadjs', () => {
4+
test('bbo.loadjs() is a Function', () => {
5+
expect(bbo.loadjs).toBeInstanceOf(Function);
6+
});
7+
8+
test('bbo.loadjs()', () => {
9+
const url = 'https://mat1.gtimg.com/www/js/libs/bbo.min.js';
10+
let ready = null;
11+
12+
bbo.loadjs(url);
13+
14+
bbo.loadjs(url, 'js_id', () => {
15+
ready = true;
16+
expect(ready).toBe(true);
17+
});
18+
19+
bbo.loadjs(
20+
url,
21+
() => {
22+
ready = true;
23+
expect(ready).toBe(true);
24+
},
25+
'js_id'
26+
);
27+
});
28+
});

0 commit comments

Comments
 (0)