REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS

This change is discussed here: https://meta.discourse.org/t/deprecating-es6-compatibility-layer/35821

Prior to this change we were not booting correctly with DISCOURSE_NO_CONSTANTS
This commit is contained in:
Sam
2015-11-21 00:14:50 +11:00
parent f5b34d5f53
commit c0b277d273
98 changed files with 380 additions and 379 deletions
+1 -1
View File
@@ -185,7 +185,7 @@ test('initial category when uncategorized is not allowed', function() {
test('open with a quote', function() {
const quote = '[quote="neil, post:5, topic:413"]\nSimmer down you two.\n[/quote]';
const newComposer = function() {
return openComposer({action: Discourse.Composer.REPLY, draftKey: 'asfd', draftSequence: 1, quote: quote});
return openComposer({action: Composer.REPLY, draftKey: 'asfd', draftSequence: 1, quote: quote});
};
equal(newComposer().get('originalText'), quote, "originalText is the quote" );
@@ -1,5 +1,7 @@
import EmailLog from 'admin/models/email-log';
module("Discourse.EmailLog");
test("create", function() {
ok(Discourse.EmailLog.create(), "it can be created without arguments");
ok(EmailLog.create(), "it can be created without arguments");
});
+3 -2
View File
@@ -1,9 +1,10 @@
import { blank } from 'helpers/qunit-helpers';
import Report from 'admin/models/report';
module("Discourse.Report");
module("Report");
function reportWithData(data) {
return Discourse.Report.create({
return Report.create({
type: 'topics',
data: _.map(data, function(val, index) {
return { x: moment().subtract(index, "days").format('YYYY-MM-DD'), y: val };
@@ -1,5 +1,7 @@
module("Discourse.StaffActionLog");
import StaffActionLog from 'admin/models/staff-action-log';
module("StaffActionLog");
test("create", function() {
ok(Discourse.StaffActionLog.create(), "it can be created without arguments");
ok(StaffActionLog.create(), "it can be created without arguments");
});
@@ -1,8 +1,10 @@
module("Discourse.VersionCheck");
import VersionCheck from 'admin/models/version-check';
module("VersionCheck");
test('dataIsOld', function() {
var dataIsOld = function(args, expected, message) {
equal(Discourse.VersionCheck.create(args).get('dataIsOld'), expected, message);
equal(VersionCheck.create(args).get('dataIsOld'), expected, message);
};
dataIsOld({updated_at: moment().subtract(2, 'hours').toJSON()}, false, '2 hours ago');
@@ -15,7 +17,7 @@ test('staleData', function() {
return moment().subtract(hoursAgo, 'hours').toJSON();
};
var staleData = function(args, expected, message) {
equal(Discourse.VersionCheck.create(args).get('staleData'), expected, message);
equal(VersionCheck.create(args).get('staleData'), expected, message);
};
staleData({missing_versions_count: 0, installed_version: '0.9.3', latest_version: '0.9.3', updated_at: updatedAt(2)}, false, 'up to date');