Upgrade QUnit to latest version

This commit is contained in:
Robin Ward
2017-06-14 13:57:58 -04:00
parent 8ae445766f
commit cc525b1a8d
145 changed files with 7569 additions and 6763 deletions

View File

@ -1,45 +1,44 @@
import { blank, present } from 'helpers/qunit-helpers';
import Singleton from 'discourse/mixins/singleton';
module("mixin:singleton");
QUnit.module("mixin:singleton");
test("current", function() {
QUnit.test("current", assert => {
var DummyModel = Ember.Object.extend({});
DummyModel.reopenClass(Singleton);
var current = DummyModel.current();
present(current, 'current returns the current instance');
equal(current, DummyModel.current(), 'calling it again returns the same instance');
notEqual(current, DummyModel.create({}), 'we can create other instances that are not the same as current');
assert.present(current, 'current returns the current instance');
assert.equal(current, DummyModel.current(), 'calling it again returns the same instance');
assert.notEqual(current, DummyModel.create({}), 'we can create other instances that are not the same as current');
});
test("currentProp reading", function() {
QUnit.test("currentProp reading", assert => {
var DummyModel = Ember.Object.extend({});
DummyModel.reopenClass(Singleton);
var current = DummyModel.current();
blank(DummyModel.currentProp('evil'), 'by default attributes are blank');
assert.blank(DummyModel.currentProp('evil'), 'by default attributes are blank');
current.set('evil', 'trout');
equal(DummyModel.currentProp('evil'), 'trout', 'after changing the instance, the value is set');
assert.equal(DummyModel.currentProp('evil'), 'trout', 'after changing the instance, the value is set');
});
test("currentProp writing", function() {
QUnit.test("currentProp writing", assert => {
var DummyModel = Ember.Object.extend({});
DummyModel.reopenClass(Singleton);
blank(DummyModel.currentProp('adventure'), 'by default attributes are blank');
assert.blank(DummyModel.currentProp('adventure'), 'by default attributes are blank');
var result = DummyModel.currentProp('adventure', 'time');
equal(result, 'time', 'it returns the new value');
equal(DummyModel.currentProp('adventure'), 'time', 'after calling currentProp the value is set');
assert.equal(result, 'time', 'it returns the new value');
assert.equal(DummyModel.currentProp('adventure'), 'time', 'after calling currentProp the value is set');
DummyModel.currentProp('count', 0);
equal(DummyModel.currentProp('count'), 0, 'we can set the value to 0');
assert.equal(DummyModel.currentProp('count'), 0, 'we can set the value to 0');
DummyModel.currentProp('adventure', null);
equal(DummyModel.currentProp('adventure'), null, 'we can set the value to null');
assert.equal(DummyModel.currentProp('adventure'), null, 'we can set the value to null');
});
test("createCurrent", function() {
QUnit.test("createCurrent", assert => {
var Shoe = Ember.Object.extend({});
Shoe.reopenClass(Singleton, {
createCurrent: function() {
@ -47,11 +46,11 @@ test("createCurrent", function() {
}
});
equal(Shoe.currentProp('toes'), 5, 'it created the class using `createCurrent`');
assert.equal(Shoe.currentProp('toes'), 5, 'it created the class using `createCurrent`');
});
test("createCurrent that returns null", function() {
QUnit.test("createCurrent that returns null", assert => {
var Missing = Ember.Object.extend({});
Missing.reopenClass(Singleton, {
createCurrent: function() {
@ -59,6 +58,6 @@ test("createCurrent that returns null", function() {
}
});
blank(Missing.current(), "it doesn't return an instance");
blank(Missing.currentProp('madeup'), "it won't raise an error asking for a property. Will just return null.");
});
assert.blank(Missing.current(), "it doesn't return an instance");
assert.blank(Missing.currentProp('madeup'), "it won't raise an error asking for a property. Will just return null.");
});