mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 02:24:19 +02:00
tests: remove extra spaces, unneeded arrays and add missing newlines
This commit is contained in:
@@ -24,7 +24,9 @@ describe('ScrollBar', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const isScrollBarHidden = () => { // IOS devices, Android devices and Browsers on Mac, hide scrollbar by default and appear it, only while scrolling. So the tests for scrollbar would fail
|
||||
// iOS, Android devices and macOS browsers hide scrollbar by default and show it only while scrolling.
|
||||
// So the tests for scrollbar would fail
|
||||
const isScrollBarHidden = () => {
|
||||
const calc = windowCalculations()
|
||||
return calc.htmlClient === calc.htmlOffset && calc.htmlClient === calc.window
|
||||
}
|
||||
@@ -52,9 +54,7 @@ describe('ScrollBar', () => {
|
||||
it('should return true if body is overflowing', () => {
|
||||
document.documentElement.style.overflowY = 'scroll'
|
||||
document.body.style.overflowY = 'scroll'
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh; width: 100%"></div>'
|
||||
].join('')
|
||||
fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
|
||||
const result = new ScrollBarHelper().isOverflowing()
|
||||
|
||||
if (isScrollBarHidden()) {
|
||||
@@ -67,9 +67,7 @@ describe('ScrollBar', () => {
|
||||
it('should return false if body is not overflowing', () => {
|
||||
doc.style.overflowY = 'hidden'
|
||||
document.body.style.overflowY = 'hidden'
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh; width: 100%"></div>'
|
||||
].join('')
|
||||
fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
|
||||
const scrollBar = new ScrollBarHelper()
|
||||
const result = scrollBar.isOverflowing()
|
||||
|
||||
@@ -81,9 +79,7 @@ describe('ScrollBar', () => {
|
||||
it('should return an integer greater than zero, if body is overflowing', () => {
|
||||
doc.style.overflowY = 'scroll'
|
||||
document.body.style.overflowY = 'scroll'
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh; width: 100%"></div>'
|
||||
].join('')
|
||||
fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
|
||||
const result = new ScrollBarHelper().getWidth()
|
||||
|
||||
if (isScrollBarHidden()) {
|
||||
@@ -96,9 +92,7 @@ describe('ScrollBar', () => {
|
||||
it('should return 0 if body is not overflowing', () => {
|
||||
document.documentElement.style.overflowY = 'hidden'
|
||||
document.body.style.overflowY = 'hidden'
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh; width: 100%"></div>'
|
||||
].join('')
|
||||
fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
|
||||
|
||||
const result = new ScrollBarHelper().getWidth()
|
||||
|
||||
@@ -109,9 +103,9 @@ describe('ScrollBar', () => {
|
||||
describe('hide - reset', () => {
|
||||
it('should adjust the inline padding of fixed elements which are full-width', done => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh; width: 100%">' +
|
||||
'<div class="fixed-top" id="fixed1" style="padding-right: 0px; width: 100vw"></div>',
|
||||
'<div class="fixed-top" id="fixed2" style="padding-right: 5px; width: 100vw"></div>',
|
||||
'<div style="height: 110vh; width: 100%">',
|
||||
' <div class="fixed-top" id="fixed1" style="padding-right: 0px; width: 100vw"></div>',
|
||||
' <div class="fixed-top" id="fixed2" style="padding-right: 5px; width: 100vw"></div>',
|
||||
'</div>'
|
||||
].join('')
|
||||
doc.style.overflowY = 'scroll'
|
||||
@@ -145,8 +139,8 @@ describe('ScrollBar', () => {
|
||||
|
||||
it('should adjust the inline margin and padding of sticky elements', done => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh">' +
|
||||
'<div class="sticky-top" style="margin-right: 10px; padding-right: 20px; width: 100vw; height: 10px"></div>',
|
||||
'<div style="height: 110vh">',
|
||||
' <div class="sticky-top" style="margin-right: 10px; padding-right: 20px; width: 100vw; height: 10px"></div>',
|
||||
'</div>'
|
||||
].join('')
|
||||
doc.style.overflowY = 'scroll'
|
||||
@@ -173,9 +167,7 @@ describe('ScrollBar', () => {
|
||||
})
|
||||
|
||||
it('should not adjust the inline margin and padding of sticky and fixed elements when element do not have full width', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div class="sticky-top" style="margin-right: 0px; padding-right: 0px; width: 50vw"></div>'
|
||||
].join('')
|
||||
fixtureEl.innerHTML = '<div class="sticky-top" style="margin-right: 0px; padding-right: 0px; width: 50vw"></div>'
|
||||
|
||||
const stickyTopEl = fixtureEl.querySelector('.sticky-top')
|
||||
const originalMargin = getMarginX(stickyTopEl)
|
||||
@@ -195,8 +187,8 @@ describe('ScrollBar', () => {
|
||||
|
||||
it('should not put data-attribute if element doesn\'t have the proper style property, should just remove style property if element didn\'t had one', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div style="height: 110vh; width: 100%">' +
|
||||
'<div class="sticky-top" id="sticky" style="width: 100vw"></div>',
|
||||
'<div style="height: 110vh; width: 100%">',
|
||||
' <div class="sticky-top" id="sticky" style="width: 100vw"></div>',
|
||||
'</div>'
|
||||
].join('')
|
||||
|
||||
@@ -243,7 +235,7 @@ describe('ScrollBar', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<style>',
|
||||
' body {',
|
||||
` padding-right: ${styleSheetPadding} }`,
|
||||
` padding-right: ${styleSheetPadding}`,
|
||||
' }',
|
||||
'</style>'
|
||||
].join('')
|
||||
@@ -283,7 +275,7 @@ describe('ScrollBar', () => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<style>',
|
||||
' body {',
|
||||
` padding-right: ${styleSheetPadding} }`,
|
||||
` padding-right: ${styleSheetPadding}`,
|
||||
' }',
|
||||
'</style>'
|
||||
].join('')
|
||||
|
Reference in New Issue
Block a user