File tree 10 files changed +171
-0
lines changed
10 files changed +171
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "extends": "eslint:recommended",
3
+ "parserOptions": {
4
+ "ecmaVersion": 8,
5
+ "ecmaFeatures": {
6
+ "impliedStrict": true
7
+ },
8
+ "sourceType": "module"
9
+ },
10
+ "env": {
11
+ "browser": true,
12
+ "es6": true
13
+ },
14
+ "globals": {
15
+ "QUnit": false
16
+ },
17
+ "rules": {
18
+ "eqeqeq": ["error", "always"],
19
+ "no-console": "warn",
20
+ "indent": [
21
+ "error",
22
+ 4,
23
+ {
24
+ "SwitchCase": 1,
25
+ "ignoreComments": true
26
+ }
27
+ ],
28
+ "quotes": [
29
+ "error",
30
+ "single",
31
+ {
32
+ "avoidEscape": true,
33
+ "allowTemplateLiterals": true
34
+ }
35
+ ],
36
+ "no-multi-spaces": [
37
+ "error",
38
+ {
39
+ "ignoreEOLComments": true
40
+ }
41
+ ],
42
+ "new-cap": "error",
43
+ "no-redeclare": [
44
+ "error",
45
+ {
46
+ "builtinGlobals": true
47
+ }
48
+ ],
49
+ "semi": ["error", "always"],
50
+ "space-in-parens": ["error"],
51
+ "space-infix-ops": "error",
52
+ "object-curly-spacing": ["error", "always"],
53
+ "comma-spacing": "error",
54
+ "space-before-function-paren": ["error", "never"],
55
+ "keyword-spacing": [
56
+ "error",
57
+ {
58
+ "before": true,
59
+ "after": true
60
+ }
61
+ ],
62
+ "array-bracket-spacing": "error"
63
+ }
64
+ }
Original file line number Diff line number Diff line change
1
+ node_modules
2
+ .env
3
+ .DS_Store
Original file line number Diff line number Diff line change
1
+ language : " node_js"
2
+ node_js : " stable"
3
+ before_script :
4
+ - npm i eslint esm jsdom
5
+ script :
6
+ - npx eslint .
7
+ - npx qunit test/index.js
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
+ < meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
8
+ < link rel ="stylesheet " href ="style.css ">
9
+ < title > Document</ title >
10
+ </ head >
11
+
12
+ < body >
13
+
14
+ < script type ="module " src ="app.js "> </ script >
15
+ </ body >
16
+
17
+ </ html >
Original file line number Diff line number Diff line change
1
+ // IMPORT MODULES under test here:
2
+ // import example from '../src/example.js';
3
+
4
+ const test = QUnit . test ;
5
+
6
+ test ( 'time to test a function' , function ( assert ) {
7
+ //Arrange
8
+ // Set up your parameters and expectations
9
+
10
+ //Act
11
+ // Call the function you're testing and set the result to a const
12
+
13
+ //Assert
14
+ // Make assertions about what is expected valid result
15
+ assert . equal ( true , false ) ;
16
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 " />
5
+ < meta name ="viewport " content ="width=device-width " />
6
+ < title > Tests</ title >
7
+ < link
8
+ rel ="stylesheet "
9
+ href ="https://code.jquery.com/qunit/qunit-2.9.1.css "
10
+ />
11
+ </ head >
12
+ < body >
13
+ < div id ="qunit "> </ div >
14
+ < div id ="qunit-fixture "> </ div >
15
+ < script src ="https://code.jquery.com/qunit/qunit-2.9.1.js "> </ script >
16
+ < script type ="module " src ="tests.js "> </ script >
17
+ </ body >
18
+ </ html >
Original file line number Diff line number Diff line change
1
+ /* eslint-disable */
2
+
3
+ // include jsdom for DOM use in tests on travis
4
+ const jsdom = require ( 'jsdom' ) ;
5
+ const { JSDOM } = jsdom ;
6
+ const { window } = new JSDOM ( `` , {
7
+ url : 'http://localhost:5500'
8
+ } ) ;
9
+ global . window = window ;
10
+ global . document = window . document ;
11
+ global . FormData = window . FormData ;
12
+ global . localStorage = window . localStorage ;
13
+ global . sessionStorage = window . sessionStorage ;
14
+ global . URLSearchParams = window . URLSearchParams ;
15
+ global . URL = window . URL ;
16
+
17
+ require = require ( 'esm' ) ( module ) ;
18
+ module . exports = require ( './tests.js' ) ;
19
+
20
+ function storageMock ( ) {
21
+ var storage = { } ;
22
+
23
+ return {
24
+ setItem : function ( key , value ) {
25
+ storage [ key ] = value || '' ;
26
+ } ,
27
+ getItem : function ( key ) {
28
+ return key in storage ? storage [ key ] : null ;
29
+ } ,
30
+ removeItem : function ( key ) {
31
+ delete storage [ key ] ;
32
+ } ,
33
+ get length ( ) {
34
+ return Object . keys ( storage ) . length ;
35
+ } ,
36
+ key : function ( i ) {
37
+ var keys = Object . keys ( storage ) ;
38
+ return keys [ i ] || null ;
39
+ }
40
+ } ;
41
+ }
42
+
43
+ Object . defineProperty ( window , 'localStorage' , {
44
+ value : storageMock ( ) ,
45
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import './example.test.js' ;
You can’t perform that action at this time.
0 commit comments