diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-06-09 04:34:56 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-06-09 10:04:24 +0300 |
commit | ccf4b9ec69c3a9d33cc02b5cf01f2ff0a866efdd (patch) | |
tree | 4752b300530184087c37a293053cfd24452d8167 /apps/systemtags/tests | |
parent | 9e767b46ec24cf9ff559339950fdfd2f7f6bd1bf (diff) |
Add visibility related methods
SystemTagsInfoView now provides public methods related to its visibility
in preparation to be used by external objects.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/systemtags/tests')
-rw-r--r-- | apps/systemtags/tests/js/systemtagsinfoviewSpec.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/apps/systemtags/tests/js/systemtagsinfoviewSpec.js b/apps/systemtags/tests/js/systemtagsinfoviewSpec.js index 449dfd859d7..2f874688112 100644 --- a/apps/systemtags/tests/js/systemtagsinfoviewSpec.js +++ b/apps/systemtags/tests/js/systemtagsinfoviewSpec.js @@ -201,4 +201,50 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { }); }); + describe('visibility', function() { + it('reports visibility based on the "hidden" class name', function() { + view.$el.addClass('hidden'); + + expect(view.isVisible()).toBeFalsy(); + + view.$el.removeClass('hidden'); + + expect(view.isVisible()).toBeTruthy(); + }); + it('is not visible after rendering', function() { + view.render(); + + expect(view.isVisible()).toBeFalsy(); + }); + it('shows and hides the element', function() { + view.show(); + + expect(view.isVisible()).toBeTruthy(); + + view.hide(); + + expect(view.isVisible()).toBeFalsy(); + + view.show(); + + expect(view.isVisible()).toBeTruthy(); + }); + }); + describe('select2', function() { + var select2Stub; + + beforeEach(function() { + select2Stub = sinon.stub($.fn, 'select2'); + }); + afterEach(function() { + select2Stub.restore(); + }); + it('opens dropdown', function() { + view.openDropdown(); + + expect(select2Stub.calledOnce).toBeTruthy(); + expect(select2Stub.thisValues[0].selector).toEqual('.systemTagsInputField'); + expect(select2Stub.withArgs('open')).toBeTruthy(); + }); + }); }); |