mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: introduces prettier for es6 files
This commit is contained in:
@ -1,19 +1,24 @@
|
||||
/* global QUnit, resetSite */
|
||||
|
||||
import sessionFixtures from 'fixtures/session-fixtures';
|
||||
import HeaderComponent from 'discourse/components/site-header';
|
||||
import { forceMobile, resetMobile } from 'discourse/lib/mobile';
|
||||
import { resetPluginApi } from 'discourse/lib/plugin-api';
|
||||
import { clearCache as clearOutletCache, resetExtraClasses } from 'discourse/lib/plugin-connectors';
|
||||
import { clearHTMLCache } from 'discourse/helpers/custom-html';
|
||||
import { flushMap } from 'discourse/models/store';
|
||||
import { clearRewrites } from 'discourse/lib/url';
|
||||
import { initSearchData } from 'discourse/widgets/search-menu';
|
||||
import { resetDecorators } from 'discourse/widgets/widget';
|
||||
import { resetCustomPostMessageCallbacks } from 'discourse/controllers/topic';
|
||||
import sessionFixtures from "fixtures/session-fixtures";
|
||||
import HeaderComponent from "discourse/components/site-header";
|
||||
import { forceMobile, resetMobile } from "discourse/lib/mobile";
|
||||
import { resetPluginApi } from "discourse/lib/plugin-api";
|
||||
import {
|
||||
clearCache as clearOutletCache,
|
||||
resetExtraClasses
|
||||
} from "discourse/lib/plugin-connectors";
|
||||
import { clearHTMLCache } from "discourse/helpers/custom-html";
|
||||
import { flushMap } from "discourse/models/store";
|
||||
import { clearRewrites } from "discourse/lib/url";
|
||||
import { initSearchData } from "discourse/widgets/search-menu";
|
||||
import { resetDecorators } from "discourse/widgets/widget";
|
||||
import { resetCustomPostMessageCallbacks } from "discourse/controllers/topic";
|
||||
|
||||
export function currentUser() {
|
||||
return Discourse.User.create(sessionFixtures['/session/current.json'].current_user);
|
||||
return Discourse.User.create(
|
||||
sessionFixtures["/session/current.json"].current_user
|
||||
);
|
||||
}
|
||||
|
||||
export function replaceCurrentUser(properties) {
|
||||
@ -30,20 +35,25 @@ const Plugin = $.fn.modal;
|
||||
const Modal = Plugin.Constructor;
|
||||
|
||||
function AcceptanceModal(option, _relatedTarget) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data('bs.modal');
|
||||
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option === 'object' && option);
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data("bs.modal");
|
||||
var options = $.extend(
|
||||
{},
|
||||
Modal.DEFAULTS,
|
||||
$this.data(),
|
||||
typeof option === "object" && option
|
||||
);
|
||||
|
||||
if (!data) $this.data('bs.modal', (data = new Modal(this, options)));
|
||||
data.$body = $('#ember-testing');
|
||||
if (!data) $this.data("bs.modal", (data = new Modal(this, options)));
|
||||
data.$body = $("#ember-testing");
|
||||
|
||||
if (typeof option === 'string') data[option](_relatedTarget);
|
||||
if (typeof option === "string") data[option](_relatedTarget);
|
||||
else if (options.show) data.show(_relatedTarget);
|
||||
});
|
||||
}
|
||||
|
||||
window.bootbox.$body = $('#ember-testing');
|
||||
window.bootbox.$body = $("#ember-testing");
|
||||
$.fn.modal = AcceptanceModal;
|
||||
|
||||
let _pretenderCallbacks = [];
|
||||
@ -64,7 +74,7 @@ export function acceptance(name, options) {
|
||||
resetMobile();
|
||||
|
||||
// For now don't do scrolling stuff in Test Mode
|
||||
HeaderComponent.reopen({examineDockHeader: function() { }});
|
||||
HeaderComponent.reopen({ examineDockHeader: function() {} });
|
||||
|
||||
resetExtraClasses();
|
||||
if (options.beforeEach) {
|
||||
@ -80,7 +90,11 @@ export function acceptance(name, options) {
|
||||
}
|
||||
|
||||
if (options.settings) {
|
||||
Discourse.SiteSettings = jQuery.extend(true, Discourse.SiteSettings, options.settings);
|
||||
Discourse.SiteSettings = jQuery.extend(
|
||||
true,
|
||||
Discourse.SiteSettings,
|
||||
options.settings
|
||||
);
|
||||
}
|
||||
|
||||
if (options.site) {
|
||||
@ -115,8 +129,10 @@ export function acceptance(name, options) {
|
||||
}
|
||||
|
||||
export function controllerFor(controller, model) {
|
||||
controller = Discourse.__container__.lookup('controller:' + controller);
|
||||
if (model) { controller.set('model', model ); }
|
||||
controller = Discourse.__container__.lookup("controller:" + controller);
|
||||
if (model) {
|
||||
controller.set("model", model);
|
||||
}
|
||||
return controller;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user