@sb1/ffe-tables-react 8.0.34 → 8.0.36
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { assert, match, spy } from 'sinon';
|
|
3
2
|
import SortableTable from './SortableTable';
|
|
4
3
|
describe('<SortableTable>', function () {
|
|
5
4
|
var columns = [
|
|
@@ -44,18 +43,72 @@ describe('<SortableTable>', function () {
|
|
|
44
43
|
expect(wrapper.find('button').length).toBe(data.length);
|
|
45
44
|
});
|
|
46
45
|
it('should call onSort after sorting table', function () {
|
|
47
|
-
var onSort =
|
|
46
|
+
var onSort = jest.fn();
|
|
48
47
|
var table = shallow(React.createElement(SortableTable, { columns: columns, data: data, onSort: onSort }));
|
|
49
48
|
table.instance().tableHeaderClicked('name');
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
expect.objectContaining({
|
|
50
|
+
sortBy: 'name',
|
|
51
|
+
descending: false,
|
|
52
|
+
tableData: [
|
|
53
|
+
{
|
|
54
|
+
age: 16,
|
|
55
|
+
button: React.createElement("button", null, "poke"),
|
|
56
|
+
id: 4,
|
|
57
|
+
name: 'Daenerys Targaryen',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
age: 20,
|
|
61
|
+
button: React.createElement("button", null, "poke"),
|
|
62
|
+
id: 1,
|
|
63
|
+
name: 'Jon Snow',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
age: 48,
|
|
67
|
+
button: React.createElement("button", null, "poke"),
|
|
68
|
+
id: 3,
|
|
69
|
+
name: 'Ned Stark',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
age: 36,
|
|
73
|
+
button: React.createElement("button", null, "poke"),
|
|
74
|
+
id: 2,
|
|
75
|
+
name: 'Zombie Mountain',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
});
|
|
53
79
|
});
|
|
54
80
|
it('should call onSort after initial sort', function () {
|
|
55
|
-
var onSort =
|
|
81
|
+
var onSort = jest.fn();
|
|
56
82
|
shallow(React.createElement(SortableTable, { columns: columns, data: data, onSort: onSort, sortBy: 'name' }));
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
expect(onSort).toHaveBeenCalledWith(expect.objectContaining({
|
|
84
|
+
sortBy: 'name',
|
|
85
|
+
descending: false,
|
|
86
|
+
tableData: [
|
|
87
|
+
{
|
|
88
|
+
age: 16,
|
|
89
|
+
button: React.createElement("button", null, "poke"),
|
|
90
|
+
id: 4,
|
|
91
|
+
name: 'Daenerys Targaryen',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
age: 20,
|
|
95
|
+
button: React.createElement("button", null, "poke"),
|
|
96
|
+
id: 1,
|
|
97
|
+
name: 'Jon Snow',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
age: 48,
|
|
101
|
+
button: React.createElement("button", null, "poke"),
|
|
102
|
+
id: 3,
|
|
103
|
+
name: 'Ned Stark',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
age: 36,
|
|
107
|
+
button: React.createElement("button", null, "poke"),
|
|
108
|
+
id: 2,
|
|
109
|
+
name: 'Zombie Mountain',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
59
112
|
}));
|
|
60
113
|
});
|
|
61
114
|
describe('condensed', function () {
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var sinon_1 = require("sinon");
|
|
8
7
|
var SortableTable_1 = __importDefault(require("./SortableTable"));
|
|
9
8
|
describe('<SortableTable>', function () {
|
|
10
9
|
var columns = [
|
|
@@ -49,18 +48,72 @@ describe('<SortableTable>', function () {
|
|
|
49
48
|
expect(wrapper.find('button').length).toBe(data.length);
|
|
50
49
|
});
|
|
51
50
|
it('should call onSort after sorting table', function () {
|
|
52
|
-
var onSort =
|
|
51
|
+
var onSort = jest.fn();
|
|
53
52
|
var table = shallow(react_1.default.createElement(SortableTable_1.default, { columns: columns, data: data, onSort: onSort }));
|
|
54
53
|
table.instance().tableHeaderClicked('name');
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
expect.objectContaining({
|
|
55
|
+
sortBy: 'name',
|
|
56
|
+
descending: false,
|
|
57
|
+
tableData: [
|
|
58
|
+
{
|
|
59
|
+
age: 16,
|
|
60
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
61
|
+
id: 4,
|
|
62
|
+
name: 'Daenerys Targaryen',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
age: 20,
|
|
66
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
67
|
+
id: 1,
|
|
68
|
+
name: 'Jon Snow',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
age: 48,
|
|
72
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
73
|
+
id: 3,
|
|
74
|
+
name: 'Ned Stark',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
age: 36,
|
|
78
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
79
|
+
id: 2,
|
|
80
|
+
name: 'Zombie Mountain',
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
});
|
|
58
84
|
});
|
|
59
85
|
it('should call onSort after initial sort', function () {
|
|
60
|
-
var onSort =
|
|
86
|
+
var onSort = jest.fn();
|
|
61
87
|
shallow(react_1.default.createElement(SortableTable_1.default, { columns: columns, data: data, onSort: onSort, sortBy: 'name' }));
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
expect(onSort).toHaveBeenCalledWith(expect.objectContaining({
|
|
89
|
+
sortBy: 'name',
|
|
90
|
+
descending: false,
|
|
91
|
+
tableData: [
|
|
92
|
+
{
|
|
93
|
+
age: 16,
|
|
94
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
95
|
+
id: 4,
|
|
96
|
+
name: 'Daenerys Targaryen',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
age: 20,
|
|
100
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
101
|
+
id: 1,
|
|
102
|
+
name: 'Jon Snow',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
age: 48,
|
|
106
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
107
|
+
id: 3,
|
|
108
|
+
name: 'Ned Stark',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
age: 36,
|
|
112
|
+
button: react_1.default.createElement("button", null, "poke"),
|
|
113
|
+
id: 2,
|
|
114
|
+
name: 'Zombie Mountain',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
64
117
|
}));
|
|
65
118
|
});
|
|
66
119
|
describe('condensed', function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-tables-react",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.36",
|
|
4
4
|
"description": "React implementation of ffe-tables",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test:watch": "ffe-buildtool jest --watch"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sb1/ffe-icons-react": "^10.0.
|
|
29
|
+
"@sb1/ffe-icons-react": "^10.0.4",
|
|
30
30
|
"@sb1/ffe-tables": "^14.0.22",
|
|
31
31
|
"classnames": "^2.3.1",
|
|
32
32
|
"deep-equal": "^1.0.1",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@sb1/ffe-buildtool": "^0.6.3",
|
|
40
40
|
"react": "^16.9.0",
|
|
41
|
-
"react-dom": "^16.9.0"
|
|
42
|
-
"sinon": "^7.2.3"
|
|
41
|
+
"react-dom": "^16.9.0"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
44
|
"react": ">=16.9.0"
|
|
@@ -47,5 +46,5 @@
|
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|
|
49
48
|
},
|
|
50
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "433cd8945569727bd23b2850e770d4465d2600d3"
|
|
51
50
|
}
|