discourse/test/javascripts/models/nav-item-test.js.es6

22 lines
682 B
Plaintext
Raw Normal View History

2017-06-15 01:57:58 +08:00
QUnit.module("Discourse.NavItem", {
beforeEach() {
2014-01-10 02:48:47 +08:00
Ember.run(function() {
2015-05-01 04:04:58 +08:00
const asianCategory = Discourse.Category.create({name: '确实是这样', id: 343434});
2014-01-10 02:48:47 +08:00
Discourse.Site.currentProp('categories').addObject(asianCategory);
});
}
});
2017-06-15 01:57:58 +08:00
QUnit.test('href', assert =>{
assert.expect(4);
function href(text, expected, label) {
2017-06-15 01:57:58 +08:00
assert.equal(Discourse.NavItem.fromText(text, {}).get('href'), expected, label);
}
href('latest', '/latest', 'latest');
href('categories', '/categories', 'categories');
href('category/bug', '/c/bug', 'English category name');
href('category/确实是这样', '/c/343434-category', 'Chinese category name');
});