mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Moving UI assets to OSS
This commit is contained in:
30
ui/tests/integration/components/toggle-button-test.js
Normal file
30
ui/tests/integration/components/toggle-button-test.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { moduleForComponent, test } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
|
||||
moduleForComponent('toggle-button', 'Integration | Component | toggle button', {
|
||||
integration: true,
|
||||
});
|
||||
|
||||
test('toggle functionality', function(assert) {
|
||||
this.set('toggleTarget', {});
|
||||
|
||||
this.render(hbs`{{toggle-button toggleTarget=toggleTarget toggleAttr="toggled"}}`);
|
||||
|
||||
assert.equal(this.$('button').text().trim(), 'More options', 'renders default closedLabel');
|
||||
|
||||
this.$('button').click();
|
||||
assert.equal(this.get('toggleTarget.toggled'), true, 'it toggles the attr on the target');
|
||||
assert.equal(this.$('button').text().trim(), 'Hide options', 'renders default openLabel');
|
||||
this.$('button').click();
|
||||
assert.equal(this.get('toggleTarget.toggled'), false, 'it toggles the attr on the target');
|
||||
|
||||
this.set('closedLabel', 'Open the options!');
|
||||
this.set('openLabel', 'Close the options!');
|
||||
this.render(
|
||||
hbs`{{toggle-button toggleTarget=toggleTarget toggleAttr="toggled" closedLabel=closedLabel openLabel=openLabel}}`
|
||||
);
|
||||
|
||||
assert.equal(this.$('button').text().trim(), 'Open the options!', 'renders passed closedLabel');
|
||||
this.$('button').click();
|
||||
assert.equal(this.$('button').text().trim(), 'Close the options!', 'renders passed openLabel');
|
||||
});
|
||||
Reference in New Issue
Block a user