2014-01-10 02:48:47 +08:00
|
|
|
var asianCategory = Discourse.Category.create({name: '确实是这样', id: 343434});
|
|
|
|
|
2013-06-18 01:04:54 +08:00
|
|
|
module("Discourse.NavItem", {
|
|
|
|
setup: function() {
|
2014-01-10 02:48:47 +08:00
|
|
|
Ember.run(function() {
|
|
|
|
Discourse.Site.currentProp('categories').addObject(asianCategory);
|
|
|
|
});
|
2013-06-18 01:04:54 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
teardown: function() {
|
2014-01-10 02:48:47 +08:00
|
|
|
Em.run(function() {
|
|
|
|
Discourse.Site.currentProp('categories').removeObject(asianCategory);
|
|
|
|
});
|
2013-06-18 01:04:54 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
test('href', function(){
|
|
|
|
expect(4);
|
|
|
|
|
2013-06-18 01:23:22 +08:00
|
|
|
function href(text, expected, label) {
|
|
|
|
equal(Discourse.NavItem.fromText(text, {}).get('href'), expected, label);
|
|
|
|
}
|
|
|
|
|
|
|
|
href('latest', '/latest', 'latest');
|
|
|
|
href('categories', '/categories', 'categories');
|
2014-10-17 00:15:31 +08:00
|
|
|
href('category/bug', '/c/bug', 'English category name');
|
|
|
|
href('category/确实是这样', '/c/343434-category', 'Chinese category name');
|
2013-06-18 01:04:54 +08:00
|
|
|
});
|