Moving UI assets to OSS

This commit is contained in:
Matthew Irish
2018-04-03 09:16:57 -05:00
parent 266a57fab2
commit 2c2f0d853f
839 changed files with 41081 additions and 0 deletions

View 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');
});