mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-23 05:33:02 +02:00
tests: tweak Jasmine's matchers usage
Use: * toBeNull * toEqual * toBeTrue * toBeFalse * toHaveSize * toHaveClass
This commit is contained in:
@@ -50,7 +50,7 @@ describe('Data', () => {
|
||||
|
||||
Data.set(div, TEST_KEY, data)
|
||||
|
||||
expect(Data.get(div, TEST_KEY)).toBe(data)
|
||||
expect(Data.get(div, TEST_KEY)).toEqual(data)
|
||||
})
|
||||
|
||||
it('should overwrite data if something is already stored', () => {
|
||||
@@ -60,6 +60,7 @@ describe('Data', () => {
|
||||
Data.set(div, TEST_KEY, data)
|
||||
Data.set(div, TEST_KEY, copy)
|
||||
|
||||
// Using `toBe` since spread creates a shallow copy
|
||||
expect(Data.get(div, TEST_KEY)).not.toBe(data)
|
||||
expect(Data.get(div, TEST_KEY)).toBe(copy)
|
||||
})
|
||||
@@ -76,7 +77,7 @@ describe('Data', () => {
|
||||
Data.set(div, TEST_KEY, data)
|
||||
Data.remove(div, UNKNOWN_KEY)
|
||||
|
||||
expect(Data.get(div, TEST_KEY)).toBe(data)
|
||||
expect(Data.get(div, TEST_KEY)).toEqual(data)
|
||||
})
|
||||
|
||||
it('should remove data for a given key', () => {
|
||||
@@ -99,7 +100,7 @@ describe('Data', () => {
|
||||
Data.set(div, UNKNOWN_KEY, copy)
|
||||
|
||||
expect(console.error).toHaveBeenCalled()
|
||||
expect(Data.get(div, UNKNOWN_KEY)).toBe(null)
|
||||
expect(Data.get(div, UNKNOWN_KEY)).toBeNull()
|
||||
})
|
||||
/* eslint-enable no-console */
|
||||
})
|
||||
|
Reference in New Issue
Block a user