diff options
| author | Johann-S <[email protected]> | 2019-09-04 17:58:29 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-11-29 20:58:26 +0200 |
| commit | 9f6b342dc710e4334b37ded90136efa1127a47cd (patch) | |
| tree | cb5d8c8bddf356dd3f8c2289b99e9f9793fba6c7 /js/tests/unit/button.spec.js | |
| parent | c63aebc86ba05f0ebb420add653b80804c6a0cff (diff) | |
| download | bootstrap-9f6b342dc710e4334b37ded90136efa1127a47cd.tar.xz bootstrap-9f6b342dc710e4334b37ded90136efa1127a47cd.zip | |
create a base component
Diffstat (limited to 'js/tests/unit/button.spec.js')
| -rw-r--r-- | js/tests/unit/button.spec.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/tests/unit/button.spec.js b/js/tests/unit/button.spec.js index 44d7b54b1..e7f6566ea 100644 --- a/js/tests/unit/button.spec.js +++ b/js/tests/unit/button.spec.js @@ -128,4 +128,24 @@ describe('Button', () => { expect(btnEl.classList.contains('active')).toEqual(false) }) }) + + describe('getInstance', () => { + it('should return button instance', () => { + fixtureEl.innerHTML = '<div></div>' + + const div = fixtureEl.querySelector('div') + const button = new Button(div) + + expect(Button.getInstance(div)).toEqual(button) + expect(Button.getInstance(div) instanceof Button).toEqual(true) + }) + + it('should return null when there is no button instance', () => { + fixtureEl.innerHTML = '<div></div>' + + const div = fixtureEl.querySelector('div') + + expect(Button.getInstance(div)).toEqual(null) + }) + }) }) |
