Skip to content

Commit fc1aa81

Browse files
committed
#56 - test suit added
1 parent 969695c commit fc1aa81

20 files changed

+857
-16
lines changed

.babelrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
presets: [
55
['@babel/preset-env', {
66
useBuiltIns: 'usage',
7+
corejs: '2',
78
targets: isModern ? { esmodules: true } : undefined,
89
}]
910
]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
vendor
22
composer.lock
33
/tests/report
4+
coverage
45

56
##IDEs
67
/.idea

dist/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/main.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/main.legacy.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jest.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
moduleFileExtensions: [
3+
"js",
4+
"vue"
5+
],
6+
transform: {
7+
".*\\.(vue)$": "vue-jest",
8+
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
9+
},
10+
setupFiles: [
11+
"<rootDir>/jest.init.js"
12+
],
13+
collectCoverage: true,
14+
collectCoverageFrom: [
15+
"<rootDir>/resources/vue/*.{js,vue}",
16+
],
17+
coverageReporters: ["html", "text-summary"]
18+
}

jest.init.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
global._ = {
2+
pick: () => {}
3+
}
4+
5+
global.AWES = {
6+
_config: {},
7+
utils: {
8+
stringifyQuery: () => {}
9+
}
10+
}
11+
12+
window.matchMedia = jest.fn().mockImplementation( query => {
13+
return {
14+
matches: false,
15+
media: query,
16+
onchange: null,
17+
addListener: jest.fn(),
18+
removeListener: jest.fn(),
19+
}
20+
})

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"name": "table-builder",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Dynamic tables with pagination and sorting for data visualization",
55
"main": "dist/js/main.js",
66
"module": "src/js/plugin.js",
77
"scripts": {
88
"start": "npm run watch",
99
"watch": "cross-env NODE_ENV=development BROWSERSLIST_ENV=modern gulp",
1010
"watch:legacy": "cross-env NODE_ENV=development BROWSERSLIST_ENV=legacy gulp",
11-
"build": "npm run build:modern && npm run build:legacy",
11+
"build": "npm test && npm run build:modern && npm run build:legacy",
1212
"build:modern": "cross-env NODE_ENV=production cross-env BROWSERSLIST_ENV=modern gulp",
13-
"build:legacy": "cross-env NODE_ENV=production cross-env BROWSERSLIST_ENV=legacy rollup -c"
13+
"build:legacy": "cross-env NODE_ENV=production cross-env BROWSERSLIST_ENV=legacy rollup -c",
14+
"test": "jest --no-cache"
1415
},
1516
"repository": {
1617
"type": "git",
@@ -38,7 +39,10 @@
3839
"devDependencies": {
3940
"@babel/core": "^7.2.2",
4041
"@babel/preset-env": "^7.3.1",
42+
"@vue/test-utils": "^1.0.0-beta.29",
4143
"autoprefixer": "^9.4.6",
44+
"babel-core": "^7.0.0-bridge.0",
45+
"babel-jest": "^24.8.0",
4246
"browser-sync": "^2.26.3",
4347
"core-js": "^2.6.3",
4448
"cross-env": "^5.2.0",
@@ -51,6 +55,7 @@
5155
"gulp-rollup": "^2.16.2",
5256
"gulp-sourcemaps": "^2.6.4",
5357
"gulp-stylus": "^2.7.0",
58+
"jest": "^24.8.0",
5459
"nib": "^1.1.2",
5560
"postcss-import": "^12.0.1",
5661
"rollup": "^0.68.2",
@@ -64,6 +69,10 @@
6469
"rollup-plugin-terser": "^4.0.2",
6570
"rollup-plugin-vue": "^4.3.2",
6671
"stylus": "^0.54.5",
72+
"vue-jest": "^3.0.4",
6773
"vue-template-compiler": "^2.5.21"
74+
},
75+
"dependencies": {
76+
"vue": "^2.6.10"
6877
}
6978
}

resources/css/main.styl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
flex-version = flex
2+
support-for-ie = false
3+
vendor-prefixes = official
4+
15
@keyframes rotate
26
from
37
transform: none
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`table-builder as a list matches overall snapshot 1`] = `"<div class=\\"int-table\\"><div class=\\"test-header-slot\\"></div> <div class=\\"int-table__list\\"><div class=\\"int-table__list-row\\"><div class=\\"test-list-slot\\"><span>0</span> <p>row 1 column 1, row 1 column 2</p></div></div><div class=\\"int-table__list-row\\"><div class=\\"test-list-slot\\"><span>1</span> <p>row 2 column 1, row 2 column 2</p></div></div><div class=\\"int-table__list-row\\"><div class=\\"test-list-slot\\"><span>2</span> <p>row 3 column 1, row 3 column 2</p></div></div></div> <div class=\\"int-table__overflow\\"><!----></div> <div class=\\"test-footer-slot\\"></div></div>"`;
4+
5+
exports[`table-builder as a table matches overall snapshot 1`] = `"<div class=\\"int-table\\"> <!----> <div class=\\"int-table__overflow\\"><table class=\\"int-table__table\\"><thead><tr><th>Col</th> <!----></tr></thead> <tbody><tr class=\\"int-table__block\\"><td class=\\"\\">row 1</td></tr> <!----><tr class=\\"int-table__block\\"><td class=\\"\\">row 2</td></tr> <!----><tr class=\\"int-table__block\\"><td class=\\"\\">row 3</td></tr> <!----></tbody></table></div> </div>"`;

0 commit comments

Comments
 (0)