@storybook/components 5.1.6 → 5.1.10
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/dist/syntaxhighlighter/syntaxhighlighter.js +1 -1
- package/dist/typings.d.js +1 -0
- package/package.json +4 -4
- package/src/syntaxhighlighter/__snapshots__/syntaxhighlighter.stories.storyshot +1 -1
- package/src/syntaxhighlighter/syntaxhighlighter.tsx +1 -1
- package/dist/Badge/__snapshots__/Badge.stories.storyshot +0 -96
- package/dist/Button/__snapshots__/Button.stories.storyshot +0 -1028
- package/dist/brand/__snapshots__/StorybookIcon.stories.storyshot +0 -36
- package/dist/form/__snapshots__/form.stories.storyshot +0 -2756
- package/dist/icon/__snapshots__/icon.stories.storyshot +0 -4960
- package/dist/spaced/__snapshots__/Spaced.stories.storyshot +0 -249
- package/dist/syntaxhighlighter/__snapshots__/syntaxhighlighter.stories.storyshot +0 -3971
- package/dist/syntaxhighlighter/formatter.test.js +0 -59
- package/dist/tabs/__snapshots__/tabs.stories.storyshot +0 -2029
- package/dist/tooltip/__snapshots__/ListItem.stories.storyshot +0 -1212
- package/dist/tooltip/__snapshots__/Tooltip.stories.storyshot +0 -269
- package/dist/tooltip/__snapshots__/TooltipLinkList.stories.storyshot +0 -326
- package/dist/tooltip/__snapshots__/TooltipMessage.stories.storyshot +0 -514
- package/dist/tooltip/__snapshots__/TooltipNote.stories.storyshot +0 -54
- package/dist/tooltip/__snapshots__/WithTooltip.stories.storyshot +0 -448
- package/dist/typings.d.ts +0 -4
- package/dist/typography/__snapshots__/typography.stories.storyshot +0 -186
- package/dist/typography/link/__snapshots__/link.stories.storyshot +0 -664
- package/dist/typography/link/link.test.d.ts +0 -1
- package/dist/typography/link/link.test.js +0 -162
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.assign");
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
|
|
9
|
-
var _link = require("./link");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
|
-
var LEFT_BUTTON = 0;
|
|
14
|
-
var MIDDLE_BUTTON = 1;
|
|
15
|
-
var RIGHT_BUTTON = 2;
|
|
16
|
-
|
|
17
|
-
var createEvent = function createEvent(options) {
|
|
18
|
-
return Object.assign({
|
|
19
|
-
button: LEFT_BUTTON,
|
|
20
|
-
preventDefault: jest.fn()
|
|
21
|
-
}, options);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
var renderLink = function renderLink(props) {
|
|
25
|
-
return (0, _enzyme.shallow)(_react["default"].createElement(_link.Link, Object.assign({
|
|
26
|
-
children: 'Content'
|
|
27
|
-
}, props)));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var setup = function setup(_ref) {
|
|
31
|
-
var props = _ref.props,
|
|
32
|
-
event = _ref.event;
|
|
33
|
-
return {
|
|
34
|
-
e: createEvent(event),
|
|
35
|
-
result: renderLink(props),
|
|
36
|
-
onClick: props.onClick || jest.fn()
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
describe('Link', function () {
|
|
41
|
-
describe('events', function () {
|
|
42
|
-
it('should call onClick on a plain left click', function () {
|
|
43
|
-
var _setup = setup({
|
|
44
|
-
props: {
|
|
45
|
-
onClick: jest.fn()
|
|
46
|
-
},
|
|
47
|
-
event: {
|
|
48
|
-
button: LEFT_BUTTON
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
result = _setup.result,
|
|
52
|
-
onClick = _setup.onClick,
|
|
53
|
-
e = _setup.e;
|
|
54
|
-
|
|
55
|
-
result.simulate('click', e);
|
|
56
|
-
expect(onClick).toHaveBeenCalledWith(e);
|
|
57
|
-
expect(e.preventDefault).toHaveBeenCalled();
|
|
58
|
-
});
|
|
59
|
-
it("shouldn't call onClick on a middle click", function () {
|
|
60
|
-
var _setup2 = setup({
|
|
61
|
-
props: {
|
|
62
|
-
onClick: jest.fn()
|
|
63
|
-
},
|
|
64
|
-
event: {
|
|
65
|
-
button: MIDDLE_BUTTON
|
|
66
|
-
}
|
|
67
|
-
}),
|
|
68
|
-
result = _setup2.result,
|
|
69
|
-
onClick = _setup2.onClick,
|
|
70
|
-
e = _setup2.e;
|
|
71
|
-
|
|
72
|
-
result.simulate('click', e);
|
|
73
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
74
|
-
expect(e.preventDefault).not.toHaveBeenCalled();
|
|
75
|
-
});
|
|
76
|
-
it("shouldn't call onClick on a right click", function () {
|
|
77
|
-
var _setup3 = setup({
|
|
78
|
-
props: {
|
|
79
|
-
onClick: jest.fn()
|
|
80
|
-
},
|
|
81
|
-
event: {
|
|
82
|
-
button: RIGHT_BUTTON
|
|
83
|
-
}
|
|
84
|
-
}),
|
|
85
|
-
result = _setup3.result,
|
|
86
|
-
onClick = _setup3.onClick,
|
|
87
|
-
e = _setup3.e;
|
|
88
|
-
|
|
89
|
-
result.simulate('click', e);
|
|
90
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
91
|
-
expect(e.preventDefault).not.toHaveBeenCalled();
|
|
92
|
-
});
|
|
93
|
-
it("shouldn't call onClick on alt+click", function () {
|
|
94
|
-
var _setup4 = setup({
|
|
95
|
-
props: {
|
|
96
|
-
onClick: jest.fn()
|
|
97
|
-
},
|
|
98
|
-
event: {
|
|
99
|
-
altKey: true
|
|
100
|
-
}
|
|
101
|
-
}),
|
|
102
|
-
result = _setup4.result,
|
|
103
|
-
onClick = _setup4.onClick,
|
|
104
|
-
e = _setup4.e;
|
|
105
|
-
|
|
106
|
-
result.simulate('click', e);
|
|
107
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
108
|
-
expect(e.preventDefault).not.toHaveBeenCalled();
|
|
109
|
-
});
|
|
110
|
-
it("shouldn't call onClick on ctrl+click", function () {
|
|
111
|
-
var _setup5 = setup({
|
|
112
|
-
props: {
|
|
113
|
-
onClick: jest.fn()
|
|
114
|
-
},
|
|
115
|
-
event: {
|
|
116
|
-
ctrlKey: true
|
|
117
|
-
}
|
|
118
|
-
}),
|
|
119
|
-
result = _setup5.result,
|
|
120
|
-
onClick = _setup5.onClick,
|
|
121
|
-
e = _setup5.e;
|
|
122
|
-
|
|
123
|
-
result.simulate('click', e);
|
|
124
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
125
|
-
expect(e.preventDefault).not.toHaveBeenCalled();
|
|
126
|
-
});
|
|
127
|
-
it("shouldn't call onClick on cmd+click / win+click", function () {
|
|
128
|
-
var _setup6 = setup({
|
|
129
|
-
props: {
|
|
130
|
-
onClick: jest.fn()
|
|
131
|
-
},
|
|
132
|
-
event: {
|
|
133
|
-
metaKey: true
|
|
134
|
-
}
|
|
135
|
-
}),
|
|
136
|
-
result = _setup6.result,
|
|
137
|
-
onClick = _setup6.onClick,
|
|
138
|
-
e = _setup6.e;
|
|
139
|
-
|
|
140
|
-
result.simulate('click', e);
|
|
141
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
142
|
-
expect(e.preventDefault).not.toHaveBeenCalled();
|
|
143
|
-
});
|
|
144
|
-
it("shouldn't call onClick on shift+click", function () {
|
|
145
|
-
var _setup7 = setup({
|
|
146
|
-
props: {
|
|
147
|
-
onClick: jest.fn()
|
|
148
|
-
},
|
|
149
|
-
event: {
|
|
150
|
-
shiftKey: true
|
|
151
|
-
}
|
|
152
|
-
}),
|
|
153
|
-
result = _setup7.result,
|
|
154
|
-
onClick = _setup7.onClick,
|
|
155
|
-
e = _setup7.e;
|
|
156
|
-
|
|
157
|
-
result.simulate('click', e);
|
|
158
|
-
expect(onClick).not.toHaveBeenCalled();
|
|
159
|
-
expect(e.preventDefault).not.toHaveBeenCalled();
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
});
|