Skip to content

Commit 3664872

Browse files
chore(merge): Bootstrap v5.3.4 (#2594)
1 parent 3f768fc commit 3664872

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2537
-3107
lines changed

.eslintrc.json

+2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@
9898
"unicorn/prefer-module": "off",
9999
"unicorn/prefer-query-selector": "off",
100100
"unicorn/prefer-spread": "off",
101+
"unicorn/prefer-string-raw": "off",
101102
"unicorn/prefer-string-replace-all": "off",
103+
"unicorn/prefer-structured-clone": "off",
102104
"unicorn/prevent-abbreviations": "off"
103105
},
104106
"overrides": [

.github/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ includes code changes) and under the terms of the
217217

218218
[Adhere to the Code Guide.](https://codeguide.co/#css)
219219

220-
- When feasible, default color palettes should comply with [WCAG color contrast guidelines](https://www.w3.org/TR/WCAG20/#visual-audio-contrast).
220+
- When feasible, default color palettes should comply with [WCAG color contrast guidelines](https://www.w3.org/TR/WCAG/#distinguishable).
221221
- Except in rare cases, don't remove default `:focus` styles (via e.g. `outline: none;`) without providing alternative styles. See [this A11Y Project post](https://www.a11yproject.com/posts/2013-01-25-never-remove-css-outlines/) for more details.
222222

223223
### JS

hugo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ params:
6969
current_ruby_version: "0.0.3"
7070
docs_version: "0.0"
7171
rfs_version: "v10.0.0"
72-
bootstrap_current_version: "5.3.3"
72+
bootstrap_current_version: "5.3.4"
7373
bootstrap_docs_version: "5.3"
7474
bootstrap_github_org: "https://github.com/twbs"
7575
repo: "https://github.com/Orange-OpenSource/Orange-Boosted-Bootstrap"

js/src/dom/manipulator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const Manipulator = {
5656

5757
for (const key of bsKeys) {
5858
let pureKey = key.replace(/^bs/, '')
59-
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)
59+
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1)
6060
attributes[pureKey] = normalizeData(element.dataset[key])
6161
}
6262

js/src/dropdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class Dropdown extends BaseComponent {
320320

321321
return {
322322
...defaultBsPopperConfig,
323-
...execute(this._config.popperConfig, [defaultBsPopperConfig])
323+
...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
324324
}
325325
}
326326

js/src/tooltip.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class Tooltip extends BaseComponent {
160160
return
161161
}
162162

163-
this._activeTrigger.click = !this._activeTrigger.click
164163
if (this._isShown()) {
165164
this._leave()
166165
return
@@ -392,7 +391,7 @@ class Tooltip extends BaseComponent {
392391
}
393392

394393
_resolvePossibleFunction(arg) {
395-
return execute(arg, [this._element])
394+
return execute(arg, [this._element, this._element])
396395
}
397396

398397
_getPopperConfig(attachment) {
@@ -438,7 +437,7 @@ class Tooltip extends BaseComponent {
438437

439438
return {
440439
...defaultBsPopperConfig,
441-
...execute(this._config.popperConfig, [defaultBsPopperConfig])
440+
...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
442441
}
443442
}
444443

js/src/util/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const defineJQueryPlugin = plugin => {
223223
}
224224

225225
const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
226-
return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue
226+
return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue
227227
}
228228

229229
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {

js/src/util/template-factory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class TemplateFactory extends Config {
143143
}
144144

145145
_resolvePossibleFunction(arg) {
146-
return execute(arg, [this])
146+
return execute(arg, [undefined, this])
147147
}
148148

149149
_putElementInTemplate(element, templateElement) {

js/tests/unit/dropdown.spec.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ describe('Dropdown', () => {
172172

173173
const popperConfig = dropdown._getPopperConfig()
174174

175-
expect(getPopperConfig).toHaveBeenCalled()
175+
// Ensure that the function was called with the default config.
176+
expect(getPopperConfig).toHaveBeenCalledWith(jasmine.objectContaining({
177+
placement: jasmine.any(String)
178+
}))
176179
expect(popperConfig.placement).toEqual('left')
177180
})
178181
})

js/tests/unit/popover.spec.js

+74
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ describe('Popover', () => {
5656
})
5757

5858
describe('show', () => {
59+
it('should toggle a popover after show', () => {
60+
return new Promise(resolve => {
61+
fixtureEl.innerHTML = '<a href="#" title="Popover" data-bs-content="https://twitter.com/getbootstrap">BS twitter</a>'
62+
63+
const popoverEl = fixtureEl.querySelector('a')
64+
const popover = new Popover(popoverEl)
65+
66+
popoverEl.addEventListener('shown.bs.popover', () => {
67+
expect(document.querySelector('.popover')).not.toBeNull()
68+
popover.toggle()
69+
})
70+
popoverEl.addEventListener('hidden.bs.popover', () => {
71+
expect(document.querySelector('.popover')).toBeNull()
72+
resolve()
73+
})
74+
75+
popover.show()
76+
})
77+
})
78+
5979
it('should show a popover', () => {
6080
return new Promise(resolve => {
6181
fixtureEl.innerHTML = '<a href="#" title="Popover" data-bs-content="https://twitter.com/getbootstrap">BS twitter</a>'
@@ -95,6 +115,60 @@ describe('Popover', () => {
95115
})
96116
})
97117

118+
it('should call content and title functions with trigger element', () => {
119+
return new Promise(resolve => {
120+
fixtureEl.innerHTML = '<a href="#" data-foo="bar">BS twitter</a>'
121+
122+
const popoverEl = fixtureEl.querySelector('a')
123+
const popover = new Popover(popoverEl, {
124+
title(el) {
125+
return el.dataset.foo
126+
},
127+
content(el) {
128+
return el.dataset.foo
129+
}
130+
})
131+
132+
popoverEl.addEventListener('shown.bs.popover', () => {
133+
const popoverDisplayed = document.querySelector('.popover')
134+
135+
expect(popoverDisplayed).not.toBeNull()
136+
expect(popoverDisplayed.querySelector('.popover-header').textContent).toEqual('bar')
137+
expect(popoverDisplayed.querySelector('.popover-body').textContent).toEqual('bar')
138+
resolve()
139+
})
140+
141+
popover.show()
142+
})
143+
})
144+
145+
it('should call content and title functions with correct this value', () => {
146+
return new Promise(resolve => {
147+
fixtureEl.innerHTML = '<a href="#" data-foo="bar">BS twitter</a>'
148+
149+
const popoverEl = fixtureEl.querySelector('a')
150+
const popover = new Popover(popoverEl, {
151+
title() {
152+
return this.dataset.foo
153+
},
154+
content() {
155+
return this.dataset.foo
156+
}
157+
})
158+
159+
popoverEl.addEventListener('shown.bs.popover', () => {
160+
const popoverDisplayed = document.querySelector('.popover')
161+
162+
expect(popoverDisplayed).not.toBeNull()
163+
expect(popoverDisplayed.querySelector('.popover-header').textContent).toEqual('bar')
164+
expect(popoverDisplayed.querySelector('.popover-body').textContent).toEqual('bar')
165+
resolve()
166+
})
167+
168+
popover.show()
169+
})
170+
})
171+
98172
it('should show a popover with just content without having header', () => {
99173
return new Promise(resolve => {
100174
fixtureEl.innerHTML = '<a href="#">Nice link</a>'

js/tests/unit/tooltip.spec.js

+36-4
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ describe('Tooltip', () => {
177177

178178
const popperConfig = tooltip._getPopperConfig('top')
179179

180-
expect(getPopperConfig).toHaveBeenCalled()
180+
// Ensure that the function was called with the default config.
181+
expect(getPopperConfig).toHaveBeenCalledWith(jasmine.objectContaining({
182+
placement: jasmine.any(String)
183+
}))
181184
expect(popperConfig.placement).toEqual('left')
182185
})
183186

@@ -919,10 +922,12 @@ describe('Tooltip', () => {
919922

920923
it('should show a tooltip with custom class provided as a function in config', () => {
921924
return new Promise(resolve => {
922-
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>'
925+
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip" data-class-a="custom-class-a" data-class-b="custom-class-b"></a>'
923926

924-
const spy = jasmine.createSpy('customClass').and.returnValue('custom-class')
925927
const tooltipEl = fixtureEl.querySelector('a')
928+
const spy = jasmine.createSpy('customClass').and.callFake(function (el) {
929+
return `${el.dataset.classA} ${this.dataset.classB}`
930+
})
926931
const tooltip = new Tooltip(tooltipEl, {
927932
customClass: spy
928933
})
@@ -931,7 +936,8 @@ describe('Tooltip', () => {
931936
const tip = document.querySelector('.tooltip')
932937
expect(tip).not.toBeNull()
933938
expect(spy).toHaveBeenCalled()
934-
expect(tip).toHaveClass('custom-class')
939+
expect(tip).toHaveClass('custom-class-a')
940+
expect(tip).toHaveClass('custom-class-b')
935941
resolve()
936942
})
937943

@@ -1337,6 +1343,32 @@ describe('Tooltip', () => {
13371343

13381344
expect(tooltip._getTitle()).toEqual('test')
13391345
})
1346+
1347+
it('should call title function with trigger element', () => {
1348+
fixtureEl.innerHTML = '<a href="#" rel="tooltip" data-foo="bar"></a>'
1349+
1350+
const tooltipEl = fixtureEl.querySelector('a')
1351+
const tooltip = new Tooltip(tooltipEl, {
1352+
title(el) {
1353+
return el.dataset.foo
1354+
}
1355+
})
1356+
1357+
expect(tooltip._getTitle()).toEqual('bar')
1358+
})
1359+
1360+
it('should call title function with correct this value', () => {
1361+
fixtureEl.innerHTML = '<a href="#" rel="tooltip" data-foo="bar"></a>'
1362+
1363+
const tooltipEl = fixtureEl.querySelector('a')
1364+
const tooltip = new Tooltip(tooltipEl, {
1365+
title() {
1366+
return this.dataset.foo
1367+
}
1368+
})
1369+
1370+
expect(tooltip._getTitle()).toEqual('bar')
1371+
})
13401372
})
13411373

13421374
describe('getInstance', () => {

js/tests/unit/util/index.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,10 @@ describe('Util', () => {
521521

522522
it('should execute if arg is function & return the result', () => {
523523
const functionFoo = (num1, num2 = 10) => num1 + num2
524-
const resultFoo = Util.execute(functionFoo, [4, 5])
524+
const resultFoo = Util.execute(functionFoo, [undefined, 4, 5])
525525
expect(resultFoo).toBe(9)
526526

527-
const resultFoo1 = Util.execute(functionFoo, [4])
527+
const resultFoo1 = Util.execute(functionFoo, [undefined, 4])
528528
expect(resultFoo1).toBe(14)
529529

530530
const functionBar = () => 'foo'

0 commit comments

Comments
 (0)