Skip to content

Commit ed3fdef

Browse files
committed
tests: update tests
1 parent d3eb7f5 commit ed3fdef

File tree

4 files changed

+115
-5
lines changed

4 files changed

+115
-5
lines changed

js/tests/integration/rollup.bundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-env node */
22

3-
const resolve = require('@rollup/plugin-node-resolve')
43
const { babel } = require('@rollup/plugin-babel')
4+
const { nodeResolve } = require('@rollup/plugin-node-resolve')
55
const replace = require('@rollup/plugin-replace')
66

77
module.exports = {
@@ -11,7 +11,7 @@ module.exports = {
1111
format: 'iife'
1212
},
1313
plugins: [
14-
resolve(),
14+
nodeResolve(),
1515
babel({
1616
exclude: 'node_modules/**',
1717
babelHelpers: 'bundled'

js/tests/karma.conf.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* eslint-env node */
2+
23
const path = require('path')
34
const ip = require('ip')
45
const { babel } = require('@rollup/plugin-babel')
56
const istanbul = require('rollup-plugin-istanbul')
6-
const resolve = require('@rollup/plugin-node-resolve')
7+
const { nodeResolve } = require('@rollup/plugin-node-resolve')
78
const replace = require('@rollup/plugin-replace')
89

9-
1010
const {
1111
browsers,
1212
browsersKeys
@@ -84,7 +84,7 @@ const conf = {
8484
replace({
8585
'process.env.NODE_ENV': JSON.stringify('production')
8686
}),
87-
resolve()
87+
nodeResolve()
8888
],
8989
output: {
9090
format: 'iife',

js/tests/unit/tooltip.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,28 @@ describe('Tooltip', () => {
324324
tooltip.show()
325325
})
326326

327+
it('should show a tooltip when hovering a children element', done => {
328+
fixtureEl.innerHTML =
329+
'<a href="#" rel="tooltip" title="Another tooltip">' +
330+
'<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 100 100">' +
331+
'<rect width="100%" fill="#563d7c"/>' +
332+
'<circle cx="50" cy="50" r="30" fill="#fff"/>' +
333+
'</svg>' +
334+
'</a>'
335+
336+
const tooltipEl = fixtureEl.querySelector('a')
337+
const tooltip = new Tooltip(tooltipEl)
338+
339+
spyOn(tooltip, 'show')
340+
341+
tooltipEl.querySelector('rect').dispatchEvent(createEvent('mouseover', { bubbles: true }))
342+
343+
setTimeout(() => {
344+
expect(tooltip.show).toHaveBeenCalled()
345+
done()
346+
}, 0)
347+
})
348+
327349
it('should show a tooltip on mobile', done => {
328350
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
329351

stories/toasts.stories.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,91 @@ export const Stacking = () => `
6767
</div>
6868
</div>
6969
`
70+
71+
export const Variants = () => `
72+
<div class="toaster">
73+
<div class="toast toast-primary" role="alert" aria-live="assertive" aria-atomic="true" style="opacity:1">
74+
<div class="toast-header">
75+
<img src="..." class="rounded mr-2" alt="...">
76+
<strong class="mr-auto">Bootstrap</strong>
77+
<small>just now</small>
78+
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
79+
<span aria-hidden="true">&times;</span>
80+
</button>
81+
</div>
82+
<div class="toast-body">
83+
See? Just like this.
84+
</div>
85+
</div>
86+
87+
<div class="toast toast-secondary" role="alert" aria-live="assertive" aria-atomic="true" style="opacity:1">
88+
<div class="toast-header">
89+
<img src="..." class="rounded mr-2" alt="...">
90+
<strong class="mr-auto">Bootstrap</strong>
91+
<small class="text-muted">2 seconds ago</small>
92+
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
93+
<span aria-hidden="true">&times;</span>
94+
</button>
95+
</div>
96+
<div class="toast-body">
97+
Heads up, toasts will stack automatically
98+
</div>
99+
</div>
100+
101+
<div class="toast toast-success" role="alert" aria-live="assertive" aria-atomic="true" style="opacity:1">
102+
<div class="toast-header">
103+
<img src="..." class="rounded mr-2" alt="...">
104+
<strong class="mr-auto">Bootstrap</strong>
105+
<small>just now</small>
106+
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
107+
<span aria-hidden="true">&times;</span>
108+
</button>
109+
</div>
110+
<div class="toast-body">
111+
Heads up, toasts will stack automatically
112+
</div>
113+
</div>
114+
115+
<div class="toast toast-info" role="alert" aria-live="assertive" aria-atomic="true" style="opacity:1">
116+
<div class="toast-header">
117+
<img src="..." class="rounded mr-2" alt="...">
118+
<strong class="mr-auto">Bootstrap</strong>
119+
<small>just now</small>
120+
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
121+
<span aria-hidden="true">&times;</span>
122+
</button>
123+
</div>
124+
<div class="toast-body">
125+
Heads up, toasts will stack automatically
126+
</div>
127+
</div>
128+
129+
<div class="toast toast-danger" role="alert" aria-live="assertive" aria-atomic="true" style="opacity:1">
130+
<div class="toast-header">
131+
<img src="..." class="rounded mr-2" alt="...">
132+
<strong class="mr-auto">Bootstrap</strong>
133+
<small>just now</small>
134+
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
135+
<span aria-hidden="true">&times;</span>
136+
</button>
137+
</div>
138+
<div class="toast-body">
139+
Heads up, toasts will stack automatically
140+
</div>
141+
</div>
142+
143+
<div class="toast toast-warning" role="alert" aria-live="assertive" aria-atomic="true" style="opacity:1">
144+
<div class="toast-header">
145+
<img src="..." class="rounded mr-2" alt="...">
146+
<strong class="mr-auto">Bootstrap</strong>
147+
<small>just now</small>
148+
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
149+
<span aria-hidden="true">&times;</span>
150+
</button>
151+
</div>
152+
<div class="toast-body">
153+
Heads up, toasts will stack automatically
154+
</div>
155+
</div>
156+
</div>
157+
`

0 commit comments

Comments
 (0)