Remove ObjectController, Discouse Controllers + Presence

This commit is contained in:
Robin Ward
2015-08-11 12:27:07 -04:00
parent e2e3e7c0e0
commit 02a968bd27
130 changed files with 187 additions and 349 deletions

View File

@ -1,5 +1,6 @@
module("Discourse.AdminUser");
import { blank, present } from 'helpers/qunit-helpers';
module("Discourse.AdminUser");
asyncTestDiscourse('generate key', function() {
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 1234, key: 'asdfasdf'}}));

View File

@ -1,3 +1,5 @@
import { present } from 'helpers/qunit-helpers';
module("Discourse.ApiKey");
test('create', function() {

View File

@ -1,8 +0,0 @@
import DiscourseController from 'discourse/controllers/controller';
import Presence from 'discourse/mixins/presence';
module("DiscourseController");
test("includes mixins", function() {
ok(Presence.detect(DiscourseController.create()), "has Presence");
});

View File

@ -1,3 +1,5 @@
import { blank, present } from 'helpers/qunit-helpers';
moduleFor('controller:topic', 'controller:topic', {
needs: ['controller:header', 'controller:modal', 'controller:composer', 'controller:quote-button',
'controller:search', 'controller:topic-progress', 'controller:application']

View File

@ -8,14 +8,6 @@ function count(selector) {
return find(selector).length;
}
function present(obj, text) {
ok(!Ember.isEmpty(obj), text);
}
function blank(obj, text) {
ok(Ember.isEmpty(obj), text);
}
function containsInstance(collection, klass, text) {
ok(klass.detectInstance(_.first(collection)), text);
}

View File

@ -1,3 +1,4 @@
import { blank } from 'helpers/qunit-helpers';
module("helper:custom-html");
import { getCustomHTML, setCustomHTML } from 'discourse/helpers/custom-html';

View File

@ -1,4 +1,4 @@
/* global asyncTest */
/* global asyncTest, fixtures */
import sessionFixtures from 'fixtures/session-fixtures';
import siteFixtures from 'fixtures/site_fixtures';
@ -101,4 +101,19 @@ function fixture(selector) {
return $("#qunit-fixture");
}
export { acceptance, controllerFor, asyncTestDiscourse, fixture, logIn, currentUser };
function present(obj, text) {
ok(!Ember.isEmpty(obj), text);
}
function blank(obj, text) {
ok(Ember.isEmpty(obj), text);
}
export { acceptance,
controllerFor,
asyncTestDiscourse,
fixture,
logIn,
currentUser,
blank,
present };

View File

@ -1,3 +1,5 @@
import { blank, present } from 'helpers/qunit-helpers';
module("lib:category-link");
import parseHTML from 'helpers/parse-html';

View File

@ -1,3 +1,4 @@
import { blank } from 'helpers/qunit-helpers';
import DiscourseURL from "discourse/lib/url";
import ClickTrack from "discourse/lib/click-track";

View File

@ -1,3 +1,5 @@
import { blank } from 'helpers/qunit-helpers';
module("Discourse.PreloadStore", {
setup: function() {
PreloadStore.store('bane', 'evil');

View File

@ -1,3 +1,5 @@
import { blank } from 'helpers/qunit-helpers';
module("Discourse.Utilities");
var utils = Discourse.Utilities;
@ -123,8 +125,8 @@ test("avatarUrl", function() {
});
var setDevicePixelRatio = function(value) {
if(Object.defineProperty) {
Object.defineProperty(window, "devicePixelRatio", { value: 2 })
if (Object.defineProperty && !window.hasOwnProperty('devicePixelRatio')) {
Object.defineProperty(window, "devicePixelRatio", { value: 2 });
} else {
window.devicePixelRatio = value;
}

View File

@ -1,27 +0,0 @@
import Presence from 'discourse/mixins/presence';
module("mixin:presence");
var testObj = Em.Object.createWithMixins(Presence, {
emptyString: "",
nonEmptyString: "Evil Trout",
emptyArray: [],
nonEmptyArray: [1, 2, 3],
age: 34
});
test("present", function() {
ok(testObj.present('nonEmptyString'), "Non empty strings are present");
ok(!testObj.present('emptyString'), "Empty strings are not present");
ok(testObj.present('nonEmptyArray'), "Non Empty Arrays are present");
ok(!testObj.present('emptyArray'), "Empty arrays are not present");
ok(testObj.present('age'), "integers are present");
});
test("blank", function() {
ok(testObj.blank('emptyString'), "Empty strings are blank");
ok(!testObj.blank('nonEmptyString'), "Non empty strings are not blank");
ok(testObj.blank('emptyArray'), "Empty arrays are blank");
ok(!testObj.blank('nonEmptyArray'), "Non empty arrays are not blank");
ok(testObj.blank('missing'), "Missing properties are blank");
});

View File

@ -1,3 +1,4 @@
import { blank, present } from 'helpers/qunit-helpers';
import Singleton from 'discourse/mixins/singleton';
module("mixin:singleton");

View File

@ -1,3 +1,4 @@
import { blank } from 'helpers/qunit-helpers';
import { currentUser } from 'helpers/qunit-helpers';
module("model:composer");

View File

@ -1,11 +1,6 @@
import Presence from 'discourse/mixins/presence';
import Model from 'discourse/models/model';
module("Discourse.Model");
test("mixes in Presence", function() {
ok(Presence.detect(Model.create()));
});
module("model:discourse");
test("extractByKey: converts a list of hashes into a hash of instances of specified class, indexed by their ids", function() {
var firstObject = {id: "id_1", foo: "foo_1"};

View File

@ -1,3 +1,4 @@
import { blank, present } from 'helpers/qunit-helpers';
module("model:post-stream");
import createStore from 'helpers/create-store';

View File

@ -1,3 +1,5 @@
import { present, blank } from 'helpers/qunit-helpers';
module("Discourse.Post");
var buildPost = function(args) {

View File

@ -1,3 +1,5 @@
import { blank } from 'helpers/qunit-helpers';
module("Discourse.Report");
function reportWithData(data) {

View File

@ -1,3 +1,5 @@
import { blank, present } from 'helpers/qunit-helpers';
module("Discourse.Site");
test('create', function() {

View File

@ -1,3 +1,4 @@
import { present } from 'helpers/qunit-helpers';
module("model:topic-details");
import Topic from 'discourse/models/topic';

View File

@ -1,3 +1,4 @@
import { blank, present } from 'helpers/qunit-helpers';
module("model:topic");
import Topic from 'discourse/models/topic';

View File

@ -1,4 +1,6 @@
module("Discourse.User");
import { blank, present } from 'helpers/qunit-helpers';
module("Discourse.UserStream");
test('basics', function(){
var user = Discourse.User.create({id: 1, username: 'eviltrout'});

View File

@ -1,5 +1,3 @@
import Presence from 'discourse/mixins/presence';
var SomeViewClass = Ember.View.extend();
function containerHasOnlyOneChild(containerView, klass) {
@ -19,11 +17,6 @@ function childHasProperty(containerView, name) {
moduleFor("view:container");
test("mixes in Presence", function() {
var containerView = this.subject();
ok(Presence.detect(containerView));
});
test("attachViewWithArgs: creates a view of a given class with given properties and appends it to the container", function() {
var containerView = this.subject();
containerView.attachViewWithArgs({foo: "foo"}, SomeViewClass);