html-browser-tester 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser-test.js +7 -3
- package/lib/expect/assert.js +5 -1
- package/lib/expect/index.js +7 -3
- package/lib/main.js +4 -2
- package/package.json +1 -1
- package/tsconfig.json +1 -1
package/lib/browser-test.js
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BrowserTester = void 0;
|
4
|
+
const expect_1 = require("./expect");
|
5
|
+
class BrowserTester {
|
3
6
|
html = '';
|
4
7
|
width;
|
5
8
|
height;
|
6
9
|
iframe;
|
7
10
|
tests = [];
|
8
|
-
expects = new Expect();
|
11
|
+
expects = new expect_1.Expect();
|
9
12
|
beforeEachCallbacks = [];
|
10
13
|
afterEachCallbacks = [];
|
11
14
|
constructor({ html = '', width, height, }) {
|
@@ -84,3 +87,4 @@ export class BrowserTester {
|
|
84
87
|
});
|
85
88
|
}
|
86
89
|
}
|
90
|
+
exports.BrowserTester = BrowserTester;
|
package/lib/expect/assert.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.assert = void 0;
|
4
|
+
const assert = (expected) => ({
|
2
5
|
toBe: (resut) => {
|
3
6
|
return expected === resut;
|
4
7
|
},
|
@@ -60,3 +63,4 @@ export const assert = (expected) => ({
|
|
60
63
|
return false;
|
61
64
|
},
|
62
65
|
});
|
66
|
+
exports.assert = assert;
|
package/lib/expect/index.js
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Expect = void 0;
|
4
|
+
const assert_1 = require("./assert");
|
5
|
+
class Expect {
|
3
6
|
expects = [];
|
4
7
|
expect(expected) {
|
5
|
-
const assertedObject = assert(expected);
|
8
|
+
const assertedObject = (0, assert_1.assert)(expected);
|
6
9
|
const returnObject = {
|
7
10
|
not: {},
|
8
11
|
};
|
@@ -25,3 +28,4 @@ export class Expect {
|
|
25
28
|
return this.expects.every(e => e);
|
26
29
|
}
|
27
30
|
}
|
31
|
+
exports.Expect = Expect;
|
package/lib/main.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const browser_test_1 = require("./browser-test");
|
2
4
|
const html = `
|
3
5
|
<!DOCTYPE html>
|
4
6
|
<html lang="ja">
|
@@ -20,7 +22,7 @@ const html = `
|
|
20
22
|
</html>
|
21
23
|
`;
|
22
24
|
const main = async () => {
|
23
|
-
const browserTest = new BrowserTester({ html, width: 980, height: 980 });
|
25
|
+
const browserTest = new browser_test_1.BrowserTester({ html, width: 980, height: 980 });
|
24
26
|
browserTest.test('h1,h2 textContent should have right textContent', async (_, doc) => {
|
25
27
|
const h1 = doc.querySelector('h1');
|
26
28
|
const h2 = doc.querySelector('h2');
|
package/package.json
CHANGED