mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:51:07 +08:00
Remove ObjectController, Discouse Controllers + Presence
This commit is contained in:
@ -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'}}));
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { present } from 'helpers/qunit-helpers';
|
||||
|
||||
module("Discourse.ApiKey");
|
||||
|
||||
test('create', function() {
|
||||
|
@ -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");
|
||||
});
|
@ -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']
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { blank } from 'helpers/qunit-helpers';
|
||||
module("helper:custom-html");
|
||||
|
||||
import { getCustomHTML, setCustomHTML } from 'discourse/helpers/custom-html';
|
||||
|
@ -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 };
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { blank, present } from 'helpers/qunit-helpers';
|
||||
|
||||
module("lib:category-link");
|
||||
|
||||
import parseHTML from 'helpers/parse-html';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { blank } from 'helpers/qunit-helpers';
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import ClickTrack from "discourse/lib/click-track";
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { blank } from 'helpers/qunit-helpers';
|
||||
|
||||
module("Discourse.PreloadStore", {
|
||||
setup: function() {
|
||||
PreloadStore.store('bane', 'evil');
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
});
|
@ -1,3 +1,4 @@
|
||||
import { blank, present } from 'helpers/qunit-helpers';
|
||||
import Singleton from 'discourse/mixins/singleton';
|
||||
|
||||
module("mixin:singleton");
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { blank } from 'helpers/qunit-helpers';
|
||||
import { currentUser } from 'helpers/qunit-helpers';
|
||||
|
||||
module("model:composer");
|
||||
|
@ -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"};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { blank, present } from 'helpers/qunit-helpers';
|
||||
module("model:post-stream");
|
||||
|
||||
import createStore from 'helpers/create-store';
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { present, blank } from 'helpers/qunit-helpers';
|
||||
|
||||
module("Discourse.Post");
|
||||
|
||||
var buildPost = function(args) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { blank } from 'helpers/qunit-helpers';
|
||||
|
||||
module("Discourse.Report");
|
||||
|
||||
function reportWithData(data) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { blank, present } from 'helpers/qunit-helpers';
|
||||
|
||||
module("Discourse.Site");
|
||||
|
||||
test('create', function() {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { present } from 'helpers/qunit-helpers';
|
||||
module("model:topic-details");
|
||||
|
||||
import Topic from 'discourse/models/topic';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { blank, present } from 'helpers/qunit-helpers';
|
||||
module("model:topic");
|
||||
|
||||
import Topic from 'discourse/models/topic';
|
||||
|
@ -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'});
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user