discourse/test/javascripts/components/text-field-test.js.es6

49 lines
1.2 KiB
Plaintext
Raw Normal View History

import componentTest from 'helpers/component-test';
moduleForComponent("text-field", { integration: true });
componentTest("renders correctly with no properties set", {
template: `{{text-field}}`,
test(assert) {
assert.ok(this.$('input[type=text]').length);
}
});
componentTest("support a placeholder", {
template: `{{text-field placeholderKey="placeholder.i18n.key"}}`,
2017-06-14 13:57:58 -04:00
beforeEach() {
sandbox.stub(I18n, "t").returnsArg(0);
},
test(assert) {
assert.ok(this.$('input[type=text]').length);
assert.equal(this.$('input').prop('placeholder'), 'placeholder.i18n.key');
}
});
2018-01-29 20:42:19 -05:00
componentTest("sets the dir attribute to ltr for Hebrew text", {
template: `{{text-field value='זהו שם עברי עם מקום עברי'}}`,
beforeEach() {
this.siteSettings.support_mixed_text_direction = true;
},
test(assert) {
assert.equal(this.$('input').attr('dir'), 'rtl');
}
});
componentTest("sets the dir attribute to ltr for English text", {
template: `{{text-field value='This is a ltr title'}}`,
beforeEach() {
this.siteSettings.support_mixed_text_direction = true;
},
test(assert) {
assert.equal(this.$('input').attr('dir'), 'ltr');
}
});