Skip to content

Commit

Permalink
Make the spies declarations the same everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
louismaximepiton authored and GeoSot committed May 31, 2022
1 parent 4b54423 commit eef439e
Show file tree
Hide file tree
Showing 18 changed files with 337 additions and 341 deletions.
4 changes: 2 additions & 2 deletions js/tests/unit/alert.spec.js
Expand Up @@ -148,14 +148,14 @@ describe('Alert', () => {
const alertEl = fixtureEl.querySelector('.alert')
const alert = new Alert(alertEl)

spyOn(alert, 'close')
const spy = spyOn(alert, 'close')

jQueryMock.fn.alert = Alert.jQueryInterface
jQueryMock.elements = [alertEl]

jQueryMock.fn.alert.call(jQueryMock, 'close')

expect(alert.close).toHaveBeenCalled()
expect(spy).toHaveBeenCalled()
})

it('should create new alert instance and call close', () => {
Expand Down
4 changes: 2 additions & 2 deletions js/tests/unit/base-component.spec.js
Expand Up @@ -108,11 +108,11 @@ describe('Base Component', () => {

it('should de-register element event listeners', () => {
createInstance()
spyOn(EventHandler, 'off')
const spy = spyOn(EventHandler, 'off')

instance.dispose()

expect(EventHandler.off).toHaveBeenCalledWith(element, DummyClass.EVENT_KEY)
expect(spy).toHaveBeenCalledWith(element, DummyClass.EVENT_KEY)
})
})

Expand Down
4 changes: 2 additions & 2 deletions js/tests/unit/button.spec.js
Expand Up @@ -100,14 +100,14 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
const button = new Button(btnEl)

spyOn(button, 'toggle')
const spy = spyOn(button, 'toggle')

jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]

jQueryMock.fn.button.call(jQueryMock, 'toggle')

expect(button.toggle).toHaveBeenCalled()
expect(spy).toHaveBeenCalled()
})

it('should create new button instance and call toggle', () => {
Expand Down

0 comments on commit eef439e

Please sign in to comment.