mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: use the correct notification levels titles for PMs
This commit is contained in:

committed by
Joffrey JAFFEUX

parent
7efdccdbc5
commit
bfe0178270
@ -1,17 +1,26 @@
|
||||
import componentTest from "helpers/component-test";
|
||||
import Topic from "discourse/models/topic";
|
||||
|
||||
const buildTopic = function(level) {
|
||||
const buildTopic = function(level, archetype = "regular") {
|
||||
return Topic.create({
|
||||
id: 4563,
|
||||
title: "Qunit Test Topic",
|
||||
details: {
|
||||
notification_level: level
|
||||
}
|
||||
},
|
||||
archetype
|
||||
});
|
||||
};
|
||||
|
||||
moduleForComponent("topic-notifications-button", { integration: true });
|
||||
const originalTranslation = I18n.translations.en.js.topic.notifications.tracking_pm.title;
|
||||
|
||||
moduleForComponent("topic-notifications-button", {
|
||||
integration: true,
|
||||
|
||||
afterEach() {
|
||||
I18n.translations.en.js.topic.notifications.tracking_pm.title = originalTranslation;
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("the header has a localized title", {
|
||||
template:
|
||||
@ -45,3 +54,25 @@ componentTest("the header has a localized title", {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("the header has a localized title", {
|
||||
template:
|
||||
"{{topic-notifications-button notificationLevel=topic.details.notification_level topic=topic}}",
|
||||
|
||||
beforeEach() {
|
||||
I18n.translations.en.js.topic.notifications.tracking_pm.title = `${originalTranslation} PM`;
|
||||
this.set("topic", buildTopic(2, "private_message"));
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
selectKit()
|
||||
.header()
|
||||
.name(),
|
||||
`${originalTranslation} PM`,
|
||||
"it has the correct title for PMs"
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user