Skip to content

Commit

Permalink
Minor tweaks — Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit2sharma95 authored and GeoSot committed Apr 11, 2021
1 parent 330354a commit 05ca443
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion js/src/modal.js
Expand Up @@ -216,7 +216,7 @@ class Modal extends BaseComponent {

_initializeBackDrop() {
return new Backdrop({
isVisible: Boolean(this._config.backdrop), // 'static' option want to translated as 'true', and booleans will keep their value
isVisible: Boolean(this._config.backdrop), // 'static' option will be translated to true, and booleans will keep their value
isAnimated: this._isAnimated()
})
}
Expand Down
44 changes: 22 additions & 22 deletions js/tests/unit/util/backdrop.spec.js
Expand Up @@ -28,14 +28,14 @@ describe('Backdrop', () => {
isVisible: true,
isAnimated: false
})
const elems = () => document.querySelectorAll(CLASS_BACKDROP)
const getElements = () => document.querySelectorAll(CLASS_BACKDROP)

expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)

instance.show()
instance.show(() => {
expect(elems().length).toEqual(1)
elems().forEach(el => {
expect(getElements().length).toEqual(1)
getElements().forEach(el => {
expect(el.classList.contains(CLASS_NAME_SHOW)).toEqual(true)
})
done()
Expand All @@ -47,11 +47,11 @@ describe('Backdrop', () => {
isVisible: false,
isAnimated: true
})
const elems = () => document.querySelectorAll(CLASS_BACKDROP)
const getElements = () => document.querySelectorAll(CLASS_BACKDROP)

expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)
instance.show(() => {
expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)
done()
})
})
Expand All @@ -61,13 +61,13 @@ describe('Backdrop', () => {
isVisible: true,
isAnimated: true
})
const elems = () => document.querySelectorAll(CLASS_BACKDROP)
const getElements = () => document.querySelectorAll(CLASS_BACKDROP)

expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)

instance.show(() => {
expect(elems().length).toEqual(1)
elems().forEach(el => {
expect(getElements().length).toEqual(1)
getElements().forEach(el => {
expect(el.classList.contains(CLASS_NAME_FADE)).toEqual(true)
})
done()
Expand All @@ -78,9 +78,9 @@ describe('Backdrop', () => {
const instance = new Backdrop({
isVisible: true
})
const elem = () => document.querySelector(CLASS_BACKDROP)
const getElement = () => document.querySelector(CLASS_BACKDROP)
instance.show(() => {
expect(elem().parentElement).toEqual(document.body)
expect(getElement().parentElement).toEqual(document.body)
done()
})
})
Expand All @@ -96,9 +96,9 @@ describe('Backdrop', () => {
isVisible: true,
rootElement: wrapper
})
const elem = () => document.querySelector(CLASS_BACKDROP)
const getElement = () => document.querySelector(CLASS_BACKDROP)
instance.show(() => {
expect(elem().parentElement).toEqual(wrapper)
expect(getElement().parentElement).toEqual(wrapper)
done()
})
})
Expand All @@ -111,13 +111,13 @@ describe('Backdrop', () => {
isAnimated: true
})

const elems = () => document.body.querySelectorAll(CLASS_BACKDROP)
const getElements = () => document.body.querySelectorAll(CLASS_BACKDROP)

expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)
instance.show(() => {
expect(elems().length).toEqual(1)
expect(getElements().length).toEqual(1)
instance.hide(() => {
expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)
done()
})
})
Expand All @@ -142,14 +142,14 @@ describe('Backdrop', () => {
isVisible: false,
isAnimated: true
})
const elems = () => document.querySelectorAll(CLASS_BACKDROP)
const getElements = () => document.querySelectorAll(CLASS_BACKDROP)
const spy = spyOn(instance, 'dispose').and.callThrough()

expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)
expect(instance._isAppended).toEqual(false)
instance.show(() => {
instance.hide(() => {
expect(elems().length).toEqual(0)
expect(getElements().length).toEqual(0)
expect(spy).not.toHaveBeenCalled()
expect(instance._isAppended).toEqual(false)
done()
Expand Down

0 comments on commit 05ca443

Please sign in to comment.