Move TopicTrackingState to injected object

This commit is contained in:
Robin Ward
2015-09-03 16:55:55 -04:00
parent 064b62199e
commit 8e776d0fd7
33 changed files with 256 additions and 263 deletions

View File

@ -1,14 +1,14 @@
import createStore from 'helpers/create-store';
import { blank, present } from 'helpers/qunit-helpers';
module("Discourse.Site");
module("model:site");
test('create', function() {
ok(Discourse.Site.create(), 'it can create with no parameters');
});
test('instance', function() {
var site = Discourse.Site.current();
const site = Discourse.Site.current();
present(site, "We have a current site singleton");
present(site.get('categories'), "The instance has a list of categories");
@ -18,24 +18,24 @@ test('instance', function() {
});
test('create categories', function() {
var site = Discourse.Site.create({
const store = createStore();
const site = store.createRecord('site', {
categories: [{ id: 1234, name: 'Test'},
{ id: 3456, name: 'Test Subcategory', parent_category_id: 1234},
{ id: 3456, name: 'Invalid Subcategory', parent_category_id: 6666}]
{ id: 3458, name: 'Invalid Subcategory', parent_category_id: 6666}]
});
var categories = site.get('categories');
const categories = site.get('categories');
site.get('sortedCategories');
present(categories, "The categories are present");
equal(categories.length, 3, "it loaded all three categories");
var parent = categories.findBy('id', 1234);
const parent = categories.findBy('id', 1234);
present(parent, "it loaded the parent category");
blank(parent.get('parentCategory'), 'it has no parent category');
var subcategory = categories.findBy('id', 3456);
const subcategory = categories.findBy('id', 3456);
present(subcategory, "it loaded the subcategory");
equal(subcategory.get('parentCategory'), parent, "it has associated the child with the parent");