FEATURE: restructure notification HTML layout

This commit is contained in:
Régis Hanol
2014-08-05 23:36:37 +02:00
parent c2ed765396
commit 3330f5907c
5 changed files with 71 additions and 50 deletions

View File

@ -21,14 +21,31 @@ test("username property is correct", function() {
equal(controller.get("username"), "velesin");
});
test("link property returns empty string when there is no topic title", function() {
var fixtureWithEmptyTopicTitle = _.extend({}, notificationFixture, {data: {topic_title: ""}});
var controller = this.subject(fixtureWithEmptyTopicTitle);
equal(controller.get("link"), "");
test("description property returns badge name when there is one", function() {
var fixtureWithBadgeName = _.extend({}, notificationFixture, { data: { badge_name: "badge" } });
var controller = this.subject(fixtureWithBadgeName);
equal(controller.get("description"), "badge");
});
test("link property returns correctly built link when there is a topic title", function() {
var controller = this.subject(notificationFixture);
ok(controller.get("link").indexOf('/t/a-slug/1234') !== -1, 'has the correct URL');
ok(controller.get("link").indexOf('some title') !== -1, 'has the correct title');
test("description property returns empty string when there is no topic title", function() {
var fixtureWithEmptyTopicTitle = _.extend({}, notificationFixture, { data: { topic_title: "" } });
var controller = this.subject(fixtureWithEmptyTopicTitle);
equal(controller.get("description"), "");
});
test("description property returns topic title", function() {
var fixtureWithTopicTitle = _.extend({}, notificationFixture, { data: { topic_title: "topic" } });
var controller = this.subject(fixtureWithTopicTitle);
equal(controller.get("description"), "topic");
});
test("url property returns badge's url when there is a badge", function() {
var fixtureWithBadge = _.extend({}, notificationFixture, { data: { badge_id: 1, badge_name: "Badge Name"} });
var controller = this.subject(fixtureWithBadge);
equal(controller.get("url"), "/badges/1/badge-name");
});
test("url property returns topic's url when there is a topic", function() {
var controller = this.subject(notificationFixture);
equal(controller.get("url"), "/t/a-slug/1234");
});