2017-05-31 11:18:09 -04:00
|
|
|
import { mapRoutes } from 'discourse/mapping-router';
|
|
|
|
import Theme from 'admin/models/theme';
|
|
|
|
|
|
|
|
moduleFor('controller:admin-customize-themes', {
|
2017-06-14 13:57:58 -04:00
|
|
|
beforeEach() {
|
2017-05-31 11:18:09 -04:00
|
|
|
this.registry.register('router:main', mapRoutes());
|
|
|
|
},
|
|
|
|
needs: ['controller:adminUser']
|
|
|
|
});
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("can list sorted themes", function(assert) {
|
2017-05-31 11:18:09 -04:00
|
|
|
|
|
|
|
const defaultTheme = Theme.create({id: 2, 'default': true, name: 'default'});
|
|
|
|
const userTheme = Theme.create({id: 3, 'user_selectable': true, name: 'name'});
|
|
|
|
const strayTheme1 = Theme.create({id: 4, name: 'stray1'});
|
|
|
|
const strayTheme2 = Theme.create({id: 5, name: 'stray2'});
|
|
|
|
|
|
|
|
const controller = this.subject({
|
|
|
|
model:
|
|
|
|
{
|
|
|
|
content: [strayTheme2, strayTheme1, userTheme, defaultTheme]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.deepEqual(controller.get('sortedThemes').map(t=>t.get('name')), [
|
2017-05-31 11:18:09 -04:00
|
|
|
defaultTheme,
|
|
|
|
userTheme,
|
|
|
|
strayTheme1,
|
|
|
|
strayTheme2
|
|
|
|
].map(t=>t.get('name')), "sorts themes correctly");
|
|
|
|
});
|