mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 09:23:44 +08:00
correct test case and add condition
This commit is contained in:
parent
4bf3fa5356
commit
b2f26eaa60
|
@ -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'); }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user