mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
correct test case and add condition
This commit is contained in:
@ -27,7 +27,7 @@ export default createWidget('poster-name', {
|
|||||||
html(attrs) {
|
html(attrs) {
|
||||||
const username = attrs.username;
|
const username = attrs.username;
|
||||||
const name = attrs.name;
|
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'];
|
const classNames = nameFirst ? ['first','full-name'] : ['first','username'];
|
||||||
|
|
||||||
if (attrs.staff) { classNames.push('staff'); }
|
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", {
|
widgetTest("doesn't render a name if it's similar to the username", {
|
||||||
template: '{{mount-widget widget="poster-name" args=args}}',
|
template: '{{mount-widget widget="poster-name" args=args}}',
|
||||||
setup() {
|
setup() {
|
||||||
|
this.siteSettings.prioritize_username_in_ux = true;
|
||||||
|
this.siteSettings.display_name_on_posts = true;
|
||||||
this.set('args', { username: 'eviltrout', name: 'evil-trout' });
|
this.set('args', { username: 'eviltrout', name: 'evil-trout' });
|
||||||
},
|
},
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(this.$('.full-name').length, 0);
|
assert.equal(this.$('.second').length, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user