correct test case and add condition

This commit is contained in:
Sam 2016-06-08 14:57:13 +10:00
parent 4bf3fa5356
commit b2f26eaa60
2 changed files with 4 additions and 2 deletions

View File

@ -27,7 +27,7 @@ export default createWidget('poster-name', {
html(attrs) {
const username = attrs.username;
const name = attrs.name;
const nameFirst = !this.siteSettings.prioritize_username_in_ux && name && name.length > 0;
const nameFirst = this.siteSettings.display_name_on_posts && !this.siteSettings.prioritize_username_in_ux && name && name.length > 0;
const classNames = nameFirst ? ['first','full-name'] : ['first','username'];
if (attrs.staff) { classNames.push('staff'); }

View File

@ -59,9 +59,11 @@ widgetTest('disable display name on posts', {
widgetTest("doesn't render a name if it's similar to the username", {
template: '{{mount-widget widget="poster-name" args=args}}',
setup() {
this.siteSettings.prioritize_username_in_ux = true;
this.siteSettings.display_name_on_posts = true;
this.set('args', { username: 'eviltrout', name: 'evil-trout' });
},
test(assert) {
assert.equal(this.$('.full-name').length, 0);
assert.equal(this.$('.second').length, 0);
}
});