open-consul/ui-v2/tests/integration/helpers/default-test.js
John Cowen ab568f6b94
ui: Adds a default view helper for providing a default value (#4650)
If the first value passed to the helper is an empty string or undefined
then return the second value
2018-09-12 20:38:57 +01:00

33 lines
630 B
JavaScript

import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('default', 'helper:default', {
integration: true,
});
// Replace this with your real tests.
test('it renders', function(assert) {
this.set('inputValue', '1234');
this.render(hbs`{{default inputValue}}`);
assert.equal(
this.$()
.text()
.trim(),
'1234'
);
});
test('it renders the default value', function(assert) {
this.set('inputValue', '');
this.render(hbs`{{default inputValue '1234'}}`);
assert.equal(
this.$()
.text()
.trim(),
'1234'
);
});