From f3c5eeb371f25bc664980f21bc23f52f7feed896 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Wed, 15 Jun 2022 08:59:09 +0200 Subject: [PATCH] Fix linting --- .../components/custom-user-selector.js.es6 | 2 +- .../wizard/components/field-validators.js.es6 | 2 +- .../similar-topics-validator.js.es6 | 2 +- .../wizard/components/validator.js.es6 | 2 +- .../components/wizard-composer-editor.js.es6 | 2 +- .../wizard-composer-hyperlink.js.es6 | 2 +- .../components/wizard-date-input.js.es6 | 2 +- .../components/wizard-date-time-input.js.es6 | 2 +- .../components/wizard-field-checkbox.js.es6 | 2 +- .../wizard-field-composer-preview.js.es6 | 2 +- .../components/wizard-field-date-time.js.es6 | 2 +- .../components/wizard-field-date.js.es6 | 2 +- .../components/wizard-field-dropdown.js.es6 | 2 +- .../components/wizard-field-group.js.es6 | 2 +- .../components/wizard-field-number.js.es6 | 2 +- .../wizard/components/wizard-field-tag.js.es6 | 2 +- .../components/wizard-field-text.js.es6 | 2 +- .../components/wizard-field-textarea.js.es6 | 2 +- .../components/wizard-field-time.js.es6 | 2 +- .../components/wizard-field-upload.js.es6 | 2 +- .../wizard/components/wizard-field-url.js.es6 | 2 +- .../wizard-field-user-selector.js.es6 | 2 +- .../wizard/components/wizard-field.js.es6 | 9 +- .../components/wizard-group-selector.js.es6 | 2 +- .../wizard/components/wizard-no-access.js.es6 | 8 +- .../components/wizard-similar-topics.js.es6 | 2 +- .../wizard/components/wizard-step.js.es6 | 4 +- .../components/wizard-time-input.js.es6 | 2 +- .../wizard/controllers/wizard-index.js.es6 | 14 +- .../lib/initialize/create-contexts.js.es6 | 6 +- .../lib/initialize/inject-objects.js.es6 | 12 +- .../lib/initialize/patch-components.js.es6 | 10 +- .../lib/initialize/register-files.js.es6 | 14 +- .../wizard/lib/initialize/wizard.js.es6 | 29 +- assets/javascripts/wizard/models/field.js.es6 | 2 +- assets/javascripts/wizard/models/step.js.es6 | 6 +- assets/javascripts/wizard/routes/step.js.es6 | 2 +- .../wizard/routes/wizard-index.js.es6 | 12 +- .../javascripts/wizard/routes/wizard.js.es6 | 5 +- .../wizard/tests/acceptance/field-test.js.es6 | 252 +++--- .../wizard/tests/acceptance/step-test.js.es6 | 78 +- .../tests/acceptance/wizard-test.js.es6 | 105 +-- .../javascripts/wizard/tests/bootstrap.js.es6 | 2 +- .../wizard/tests/fixtures/categories.js.es6 | 400 +++++---- .../wizard/tests/fixtures/groups.js.es6 | 586 ++++++------ .../tests/fixtures/site-settings.js.es6 | 575 ++++++------ .../wizard/tests/fixtures/tags.js.es6 | 36 +- .../wizard/tests/fixtures/update.js.es6 | 8 +- .../wizard/tests/fixtures/user.js.es6 | 4 +- .../wizard/tests/fixtures/users.js.es6 | 20 +- .../wizard/tests/fixtures/wizard.js.es6 | 842 +++++++++--------- .../wizard/tests/helpers/acceptance.js.es6 | 18 +- .../wizard/tests/helpers/start-app.js.es6 | 12 +- .../wizard/tests/helpers/step.js.es6 | 15 +- .../wizard/tests/helpers/test.js.es6 | 4 +- .../wizard/tests/helpers/wizard.js.es6 | 18 +- .../javascripts/wizard/tests/pretender.js.es6 | 20 +- 57 files changed, 1620 insertions(+), 1558 deletions(-) diff --git a/assets/javascripts/wizard/components/custom-user-selector.js.es6 b/assets/javascripts/wizard/components/custom-user-selector.js.es6 index 6538cb42..56eb8f57 100644 --- a/assets/javascripts/wizard/components/custom-user-selector.js.es6 +++ b/assets/javascripts/wizard/components/custom-user-selector.js.es6 @@ -1,6 +1,6 @@ import { default as computed, - observes + observes, } from "discourse-common/utils/decorators"; import { renderAvatar } from "discourse/helpers/user-avatar"; import userSearch from "../lib/user-search"; diff --git a/assets/javascripts/wizard/components/field-validators.js.es6 b/assets/javascripts/wizard/components/field-validators.js.es6 index 15cfc181..7284241c 100644 --- a/assets/javascripts/wizard/components/field-validators.js.es6 +++ b/assets/javascripts/wizard/components/field-validators.js.es6 @@ -1,7 +1,7 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/field-validators', + layoutName: "wizard/templates/components/field-validators", actions: { perform() { diff --git a/assets/javascripts/wizard/components/similar-topics-validator.js.es6 b/assets/javascripts/wizard/components/similar-topics-validator.js.es6 index e5133d4f..4f722123 100644 --- a/assets/javascripts/wizard/components/similar-topics-validator.js.es6 +++ b/assets/javascripts/wizard/components/similar-topics-validator.js.es6 @@ -10,7 +10,7 @@ import { dasherize } from "@ember/string"; export default WizardFieldValidator.extend({ classNames: ["similar-topics-validator"], - layoutName: 'wizard/templates/components/similar-topics-validator', + layoutName: "wizard/templates/components/similar-topics-validator", similarTopics: null, hasInput: notEmpty("field.value"), hasSimilarTopics: notEmpty("similarTopics"), diff --git a/assets/javascripts/wizard/components/validator.js.es6 b/assets/javascripts/wizard/components/validator.js.es6 index cd1c3abe..aa68660c 100644 --- a/assets/javascripts/wizard/components/validator.js.es6 +++ b/assets/javascripts/wizard/components/validator.js.es6 @@ -6,7 +6,7 @@ import { getToken } from "wizard/lib/ajax"; export default Component.extend({ classNames: ["validator"], classNameBindings: ["isValid", "isInvalid"], - layoutName: 'wizard/templates/components/validator', + layoutName: "wizard/templates/components/validator", validMessageKey: null, invalidMessageKey: null, isValid: null, diff --git a/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 b/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 index e4ce3ec0..2c04cd4f 100644 --- a/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 +++ b/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 @@ -13,7 +13,7 @@ import { uploadIcon } from "discourse/lib/uploads"; import { dasherize } from "@ember/string"; export default ComposerEditor.extend({ - layoutName: 'wizard/templates/components/wizard-composer-editor', + layoutName: "wizard/templates/components/wizard-composer-editor", classNameBindings: ["fieldClass"], allowUpload: true, showLink: false, diff --git a/assets/javascripts/wizard/components/wizard-composer-hyperlink.js.es6 b/assets/javascripts/wizard/components/wizard-composer-hyperlink.js.es6 index c700d3ce..0eeeb176 100644 --- a/assets/javascripts/wizard/components/wizard-composer-hyperlink.js.es6 +++ b/assets/javascripts/wizard/components/wizard-composer-hyperlink.js.es6 @@ -2,7 +2,7 @@ import Component from "@ember/component"; export default Component.extend({ classNames: ["wizard-composer-hyperlink"], - layoutName: 'wizard/templates/components/wizard-composer-hyperlink', + layoutName: "wizard/templates/components/wizard-composer-hyperlink", actions: { addLink() { diff --git a/assets/javascripts/wizard/components/wizard-date-input.js.es6 b/assets/javascripts/wizard/components/wizard-date-input.js.es6 index 375b7195..da2711c7 100644 --- a/assets/javascripts/wizard/components/wizard-date-input.js.es6 +++ b/assets/javascripts/wizard/components/wizard-date-input.js.es6 @@ -3,7 +3,7 @@ import discourseComputed from "discourse-common/utils/decorators"; export default DateInput.extend({ useNativePicker: false, - layoutName: 'wizard/templates/components/wizard-date-input', + layoutName: "wizard/templates/components/wizard-date-input", @discourseComputed() placeholder() { diff --git a/assets/javascripts/wizard/components/wizard-date-time-input.js.es6 b/assets/javascripts/wizard/components/wizard-date-time-input.js.es6 index 0fe1e68a..84a2b03e 100644 --- a/assets/javascripts/wizard/components/wizard-date-time-input.js.es6 +++ b/assets/javascripts/wizard/components/wizard-date-time-input.js.es6 @@ -2,7 +2,7 @@ import DateTimeInput from "discourse/components/date-time-input"; import discourseComputed from "discourse-common/utils/decorators"; export default DateTimeInput.extend({ - layoutName: 'wizard/templates/components/wizard-date-time-input', + layoutName: "wizard/templates/components/wizard-date-time-input", @discourseComputed("timeFirst", "tabindex") timeTabindex(timeFirst, tabindex) { diff --git a/assets/javascripts/wizard/components/wizard-field-checkbox.js.es6 b/assets/javascripts/wizard/components/wizard-field-checkbox.js.es6 index f9653cd2..6f9daba2 100644 --- a/assets/javascripts/wizard/components/wizard-field-checkbox.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-checkbox.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-checkbox' + layoutName: "wizard/templates/components/wizard-field-checkbox", }); diff --git a/assets/javascripts/wizard/components/wizard-field-composer-preview.js.es6 b/assets/javascripts/wizard/components/wizard-field-composer-preview.js.es6 index 0aee0d13..a2056a86 100644 --- a/assets/javascripts/wizard/components/wizard-field-composer-preview.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-composer-preview.js.es6 @@ -7,7 +7,7 @@ import { ajax } from "discourse/lib/ajax"; import { on } from "discourse-common/utils/decorators"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-composer-preview', + layoutName: "wizard/templates/components/wizard-field-composer-preview", @on("init") updatePreview() { diff --git a/assets/javascripts/wizard/components/wizard-field-date-time.js.es6 b/assets/javascripts/wizard/components/wizard-field-date-time.js.es6 index a916f18e..eee98892 100644 --- a/assets/javascripts/wizard/components/wizard-field-date-time.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-date-time.js.es6 @@ -2,7 +2,7 @@ import Component from "@ember/component"; import { observes } from "discourse-common/utils/decorators"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-date-time', + layoutName: "wizard/templates/components/wizard-field-date-time", @observes("dateTime") setValue() { diff --git a/assets/javascripts/wizard/components/wizard-field-date.js.es6 b/assets/javascripts/wizard/components/wizard-field-date.js.es6 index a06d582a..df35638c 100644 --- a/assets/javascripts/wizard/components/wizard-field-date.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-date.js.es6 @@ -2,7 +2,7 @@ import Component from "@ember/component"; import { observes } from "discourse-common/utils/decorators"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-date', + layoutName: "wizard/templates/components/wizard-field-date", @observes("date") setValue() { diff --git a/assets/javascripts/wizard/components/wizard-field-dropdown.js.es6 b/assets/javascripts/wizard/components/wizard-field-dropdown.js.es6 index 4b8b7e63..e6b08102 100644 --- a/assets/javascripts/wizard/components/wizard-field-dropdown.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-dropdown.js.es6 @@ -1,7 +1,7 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-dropdown', + layoutName: "wizard/templates/components/wizard-field-dropdown", keyPress(e) { e.stopPropagation(); diff --git a/assets/javascripts/wizard/components/wizard-field-group.js.es6 b/assets/javascripts/wizard/components/wizard-field-group.js.es6 index 93538071..65a19719 100644 --- a/assets/javascripts/wizard/components/wizard-field-group.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-group.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-group' + layoutName: "wizard/templates/components/wizard-field-group", }); diff --git a/assets/javascripts/wizard/components/wizard-field-number.js.es6 b/assets/javascripts/wizard/components/wizard-field-number.js.es6 index e7c4d77f..14e1bfcd 100644 --- a/assets/javascripts/wizard/components/wizard-field-number.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-number.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-number' + layoutName: "wizard/templates/components/wizard-field-number", }); diff --git a/assets/javascripts/wizard/components/wizard-field-tag.js.es6 b/assets/javascripts/wizard/components/wizard-field-tag.js.es6 index 45343522..473bba08 100644 --- a/assets/javascripts/wizard/components/wizard-field-tag.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-tag.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-tag' + layoutName: "wizard/templates/components/wizard-field-tag", }); diff --git a/assets/javascripts/wizard/components/wizard-field-text.js.es6 b/assets/javascripts/wizard/components/wizard-field-text.js.es6 index f9d5b056..d9e7cca8 100644 --- a/assets/javascripts/wizard/components/wizard-field-text.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-text.js.es6 @@ -1,7 +1,7 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-text', + layoutName: "wizard/templates/components/wizard-field-text", keyPress(e) { e.stopPropagation(); diff --git a/assets/javascripts/wizard/components/wizard-field-textarea.js.es6 b/assets/javascripts/wizard/components/wizard-field-textarea.js.es6 index 54865d3c..e59a1707 100644 --- a/assets/javascripts/wizard/components/wizard-field-textarea.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-textarea.js.es6 @@ -1,7 +1,7 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-textarea', + layoutName: "wizard/templates/components/wizard-field-textarea", keyPress(e) { e.stopPropagation(); diff --git a/assets/javascripts/wizard/components/wizard-field-time.js.es6 b/assets/javascripts/wizard/components/wizard-field-time.js.es6 index bf954ec4..a2f2a10d 100644 --- a/assets/javascripts/wizard/components/wizard-field-time.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-time.js.es6 @@ -2,7 +2,7 @@ import Component from "@ember/component"; import { observes } from "discourse-common/utils/decorators"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-time', + layoutName: "wizard/templates/components/wizard-field-time", @observes("time") setValue() { diff --git a/assets/javascripts/wizard/components/wizard-field-upload.js.es6 b/assets/javascripts/wizard/components/wizard-field-upload.js.es6 index edadb4f0..4774e942 100644 --- a/assets/javascripts/wizard/components/wizard-field-upload.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-upload.js.es6 @@ -3,7 +3,7 @@ import Component from "@ember/component"; import { computed } from "@ember/object"; export default Component.extend(UppyUploadMixin, { - layoutName: 'wizard/templates/components/wizard-field-upload', + layoutName: "wizard/templates/components/wizard-field-upload", classNames: ["wizard-field-upload"], classNameBindings: ["isImage"], uploading: false, diff --git a/assets/javascripts/wizard/components/wizard-field-url.js.es6 b/assets/javascripts/wizard/components/wizard-field-url.js.es6 index 411b5fe9..96c10cc2 100644 --- a/assets/javascripts/wizard/components/wizard-field-url.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-url.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-url' + layoutName: "wizard/templates/components/wizard-field-url", }); diff --git a/assets/javascripts/wizard/components/wizard-field-user-selector.js.es6 b/assets/javascripts/wizard/components/wizard-field-user-selector.js.es6 index c2a32f44..7cf5b446 100644 --- a/assets/javascripts/wizard/components/wizard-field-user-selector.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-user-selector.js.es6 @@ -1,5 +1,5 @@ import Component from "@ember/component"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field-user-selector' + layoutName: "wizard/templates/components/wizard-field-user-selector", }); diff --git a/assets/javascripts/wizard/components/wizard-field.js.es6 b/assets/javascripts/wizard/components/wizard-field.js.es6 index 372ee182..493d7676 100644 --- a/assets/javascripts/wizard/components/wizard-field.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field.js.es6 @@ -4,8 +4,13 @@ import discourseComputed from "discourse-common/utils/decorators"; import { cook } from "discourse/plugins/discourse-custom-wizard/wizard/lib/text-lite"; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-field', - classNameBindings: [":wizard-field", "typeClasses", "field.invalid", "field.id"], + layoutName: "wizard/templates/components/wizard-field", + classNameBindings: [ + ":wizard-field", + "typeClasses", + "field.invalid", + "field.id", + ], @discourseComputed("field.type", "field.id") typeClasses: (type, id) => diff --git a/assets/javascripts/wizard/components/wizard-group-selector.js.es6 b/assets/javascripts/wizard/components/wizard-group-selector.js.es6 index b7523f9a..4ff56ec9 100644 --- a/assets/javascripts/wizard/components/wizard-group-selector.js.es6 +++ b/assets/javascripts/wizard/components/wizard-group-selector.js.es6 @@ -3,7 +3,7 @@ import { computed } from "@ember/object"; import { makeArray } from "discourse-common/lib/helpers"; export default ComboBox.extend({ - layoutName: 'wizard/templates/components/wizard-group-selector', + layoutName: "wizard/templates/components/wizard-group-selector", content: computed("groups.[]", "field.content.[]", function () { const whitelist = makeArray(this.field.content); return this.groups diff --git a/assets/javascripts/wizard/components/wizard-no-access.js.es6 b/assets/javascripts/wizard/components/wizard-no-access.js.es6 index 78a23aa8..492a41dc 100644 --- a/assets/javascripts/wizard/components/wizard-no-access.js.es6 +++ b/assets/javascripts/wizard/components/wizard-no-access.js.es6 @@ -4,17 +4,17 @@ import Component from "@ember/component"; import { dasherize } from "@ember/string"; export default Component.extend({ - classNameBindings: [':wizard-no-access', 'reasonClass'], - layoutName: 'wizard/templates/components/wizard-no-access', + classNameBindings: [":wizard-no-access", "reasonClass"], + layoutName: "wizard/templates/components/wizard-no-access", - @discourseComputed('reason') + @discourseComputed("reason") reasonClass(reason) { return dasherize(reason); }, @discourseComputed siteName() { - return (this.siteSettings.title || ''); + return this.siteSettings.title || ""; }, actions: { diff --git a/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 b/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 index c52bfeae..6a56873e 100644 --- a/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 +++ b/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 @@ -4,7 +4,7 @@ import { observes } from "discourse-common/utils/decorators"; export default Component.extend({ classNames: ["wizard-similar-topics"], - layoutName: 'wizard/templates/components/wizard-similar-topics', + layoutName: "wizard/templates/components/wizard-similar-topics", showTopics: true, didInsertElement() { diff --git a/assets/javascripts/wizard/components/wizard-step.js.es6 b/assets/javascripts/wizard/components/wizard-step.js.es6 index 44fcde26..cc23c5bf 100644 --- a/assets/javascripts/wizard/components/wizard-step.js.es6 +++ b/assets/javascripts/wizard/components/wizard-step.js.es6 @@ -12,7 +12,7 @@ import CustomWizard from "../models/wizard"; const alreadyWarned = {}; export default Component.extend({ - layoutName: 'wizard/templates/components/wizard-step', + layoutName: "wizard/templates/components/wizard-step", classNameBindings: [":wizard-step", "step.id"], saving: null, @@ -27,7 +27,7 @@ export default Component.extend({ }, @discourseComputed("step.index", "wizard.required") - showQuitButton: (index, required) => (index === 0 && !required), + showQuitButton: (index, required) => index === 0 && !required, showNextButton: not("step.final"), showDoneButton: alias("step.final"), diff --git a/assets/javascripts/wizard/components/wizard-time-input.js.es6 b/assets/javascripts/wizard/components/wizard-time-input.js.es6 index ec121002..14b08288 100644 --- a/assets/javascripts/wizard/components/wizard-time-input.js.es6 +++ b/assets/javascripts/wizard/components/wizard-time-input.js.es6 @@ -1,5 +1,5 @@ import TimeInput from "discourse/components/time-input"; export default TimeInput.extend({ - layoutName: 'wizard/templates/components/wizard-time-input' + layoutName: "wizard/templates/components/wizard-time-input", }); diff --git a/assets/javascripts/wizard/controllers/wizard-index.js.es6 b/assets/javascripts/wizard/controllers/wizard-index.js.es6 index 2dfdee40..f56db02d 100644 --- a/assets/javascripts/wizard/controllers/wizard-index.js.es6 +++ b/assets/javascripts/wizard/controllers/wizard-index.js.es6 @@ -6,19 +6,19 @@ const reasons = { noWizard: "none", requiresLogin: "requires_login", notPermitted: "not_permitted", - completed: "completed" -} + completed: "completed", +}; export default Controller.extend({ - noAccess: or('noWizard', 'requiresLogin', 'notPermitted', 'completed'), + noAccess: or("noWizard", "requiresLogin", "notPermitted", "completed"), - @discourseComputed('noAccessReason') + @discourseComputed("noAccessReason") noAccessI18nKey(reason) { - return reason ? `wizard.${reasons[reason]}` : 'wizard.none'; + return reason ? `wizard.${reasons[reason]}` : "wizard.none"; }, @discourseComputed noAccessReason() { - return Object.keys(reasons).find(reason => this.get(reason)); - } + return Object.keys(reasons).find((reason) => this.get(reason)); + }, }); diff --git a/assets/javascripts/wizard/lib/initialize/create-contexts.js.es6 b/assets/javascripts/wizard/lib/initialize/create-contexts.js.es6 index 022ac48e..0e637f6c 100644 --- a/assets/javascripts/wizard/lib/initialize/create-contexts.js.es6 +++ b/assets/javascripts/wizard/lib/initialize/create-contexts.js.es6 @@ -3,10 +3,10 @@ export default { const { createHelperContext } = requirejs("discourse-common/lib/helpers"); createHelperContext({ - siteSettings: container.lookup('site-settings:main'), + siteSettings: container.lookup("site-settings:main"), site: container.lookup("site:main"), session: container.lookup("session:main"), capabilities: container.lookup("capabilities:main"), }); - } -} + }, +}; diff --git a/assets/javascripts/wizard/lib/initialize/inject-objects.js.es6 b/assets/javascripts/wizard/lib/initialize/inject-objects.js.es6 index bd231ff9..51dff7e1 100644 --- a/assets/javascripts/wizard/lib/initialize/inject-objects.js.es6 +++ b/assets/javascripts/wizard/lib/initialize/inject-objects.js.es6 @@ -24,12 +24,14 @@ export default { ["site:main", site, false], ["session:main", session, false], ["service:store", Store, true], - ["adapter:rest", RestAdapter, true] + ["adapter:rest", RestAdapter, true], ]; - registrations.forEach(registration => { + registrations.forEach((registration) => { if (!app.hasRegistration(registration[0])) { - app.register(registration[0], registration[1], { instantiate: registration[2] }); + app.register(registration[0], registration[1], { + instantiate: registration[2], + }); } }); @@ -52,5 +54,5 @@ export default { } site.set("can_create_tag", false); - } -} + }, +}; diff --git a/assets/javascripts/wizard/lib/initialize/patch-components.js.es6 b/assets/javascripts/wizard/lib/initialize/patch-components.js.es6 index 10bbf700..90ded90c 100644 --- a/assets/javascripts/wizard/lib/initialize/patch-components.js.es6 +++ b/assets/javascripts/wizard/lib/initialize/patch-components.js.es6 @@ -1,11 +1,13 @@ export default { - run(app, container) { + run(_, container) { const getToken = requirejs("wizard/lib/ajax").getToken; - const isTesting = requirejs("discourse-common/config/environment").isTesting; + const isTesting = requirejs("discourse-common/config/environment") + .isTesting; - if (!isTesting) { + if (!isTesting()) { // Add a CSRF token to all AJAX requests let token = getToken(); + const session = container.lookup("session:main"); session.set("csrfToken", token); let callbacks = $.Callbacks(); $.ajaxPrefilter(callbacks.fire); @@ -156,5 +158,5 @@ export default { return resArray; }; } - } + }, }; diff --git a/assets/javascripts/wizard/lib/initialize/register-files.js.es6 b/assets/javascripts/wizard/lib/initialize/register-files.js.es6 index 8d4b850e..85079270 100644 --- a/assets/javascripts/wizard/lib/initialize/register-files.js.es6 +++ b/assets/javascripts/wizard/lib/initialize/register-files.js.es6 @@ -1,10 +1,14 @@ export default { run(app, container) { - const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars").default; + const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars") + .default; const Handlebars = requirejs("handlebars").default; - const registerRawHelpers = requirejs("discourse-common/lib/raw-handlebars-helpers").registerRawHelpers; + const registerRawHelpers = requirejs( + "discourse-common/lib/raw-handlebars-helpers" + ).registerRawHelpers; const { registerHelpers } = requirejs("discourse-common/lib/helpers"); - const jqueryPlugins = requirejs("discourse/initializers/jquery-plugins").default; + const jqueryPlugins = requirejs("discourse/initializers/jquery-plugins") + .default; Object.keys(Ember.TEMPLATES).forEach((k) => { if (k.indexOf("select-kit") === 0) { @@ -22,5 +26,5 @@ export default { registerRawHelpers(RawHandlebars, Handlebars); registerHelpers(app); jqueryPlugins.initialize(container, app); - } -} + }, +}; diff --git a/assets/javascripts/wizard/lib/initialize/wizard.js.es6 b/assets/javascripts/wizard/lib/initialize/wizard.js.es6 index 20650ec9..915e5f26 100644 --- a/assets/javascripts/wizard/lib/initialize/wizard.js.es6 +++ b/assets/javascripts/wizard/lib/initialize/wizard.js.es6 @@ -1,7 +1,8 @@ export default { name: "custom-wizard", initialize(app) { - const isTesting = requirejs("discourse-common/config/environment").isTesting; + const isTesting = requirejs("discourse-common/config/environment") + .isTesting; const isWizard = window.location.pathname.indexOf("/w/") > -1; if (!isWizard && !isTesting()) { @@ -9,14 +10,17 @@ export default { } const container = app.__container__; - const setDefaultOwner = requirejs("discourse-common/lib/get-owner").setDefaultOwner; + const setDefaultOwner = requirejs("discourse-common/lib/get-owner") + .setDefaultOwner; setDefaultOwner(container); if (!isTesting()) { const PreloadStore = requirejs("discourse/lib/preload-store").default; let preloaded; - const preloadedDataElement = document.getElementById("data-preloaded-wizard"); + const preloadedDataElement = document.getElementById( + "data-preloaded-wizard" + ); if (preloadedDataElement) { preloaded = JSON.parse(preloadedDataElement.dataset.preloadedWizard); } @@ -28,7 +32,8 @@ export default { app.SiteSettings = PreloadStore.get("siteSettings"); } - const setEnvironment = requirejs("discourse-common/config/environment").setEnvironment; + const setEnvironment = requirejs("discourse-common/config/environment") + .setEnvironment; const setupData = document.getElementById("data-discourse-setup").dataset; setEnvironment(setupData.environment); @@ -38,13 +43,15 @@ export default { session.set("markdownItUrl", setupData.markdownItUrl); [ - 'register-files', - 'inject-objects', - 'create-contexts', - 'patch-components' - ].forEach(fileName => { - const initializer = requirejs(`discourse/plugins/discourse-custom-wizard/wizard/lib/initialize/${fileName}`).default; + "register-files", + "inject-objects", + "create-contexts", + "patch-components", + ].forEach((fileName) => { + const initializer = requirejs( + `discourse/plugins/discourse-custom-wizard/wizard/lib/initialize/${fileName}` + ).default; initializer.run(app, container); }); - } + }, }; diff --git a/assets/javascripts/wizard/models/field.js.es6 b/assets/javascripts/wizard/models/field.js.es6 index 5f76074e..2b88140e 100644 --- a/assets/javascripts/wizard/models/field.js.es6 +++ b/assets/javascripts/wizard/models/field.js.es6 @@ -75,5 +75,5 @@ export default EmberObject.extend(ValidState, { this.setValid(valid); return valid; - } + }, }); diff --git a/assets/javascripts/wizard/models/step.js.es6 b/assets/javascripts/wizard/models/step.js.es6 index b0829312..36503276 100644 --- a/assets/javascripts/wizard/models/step.js.es6 +++ b/assets/javascripts/wizard/models/step.js.es6 @@ -72,11 +72,7 @@ export default EmberObject.extend(ValidState, { type: "PUT", data: { fields }, }).catch((response) => { - if ( - response && - response.responseJSON && - response.responseJSON.errors - ) { + if (response && response.responseJSON && response.responseJSON.errors) { let wizardErrors = []; response.responseJSON.errors.forEach((err) => { if (err.field === wizardId) { diff --git a/assets/javascripts/wizard/routes/step.js.es6 b/assets/javascripts/wizard/routes/step.js.es6 index 2454fc95..a076951f 100644 --- a/assets/javascripts/wizard/routes/step.js.es6 +++ b/assets/javascripts/wizard/routes/step.js.es6 @@ -26,7 +26,7 @@ export default Route.extend({ }, renderTemplate() { - this.render('wizard/templates/step'); + this.render("wizard/templates/step"); }, setupController(controller, model) { diff --git a/assets/javascripts/wizard/routes/wizard-index.js.es6 b/assets/javascripts/wizard/routes/wizard-index.js.es6 index 16b1140a..264cb0a2 100644 --- a/assets/javascripts/wizard/routes/wizard-index.js.es6 +++ b/assets/javascripts/wizard/routes/wizard-index.js.es6 @@ -4,7 +4,13 @@ import Route from "@ember/routing/route"; export default Route.extend({ beforeModel() { const wizard = getCachedWizard(); - if (wizard && wizard.user && wizard.permitted && !wizard.completed && wizard.start) { + if ( + wizard && + wizard.user && + wizard.permitted && + !wizard.completed && + wizard.start + ) { this.replaceWith("step", wizard.start); } }, @@ -14,7 +20,7 @@ export default Route.extend({ }, renderTemplate() { - this.render('wizard/templates/wizard-index'); + this.render("wizard/templates/wizard-index"); }, setupController(controller, model) { @@ -39,5 +45,5 @@ export default Route.extend({ } else { controller.set("noWizard", true); } - } + }, }); diff --git a/assets/javascripts/wizard/routes/wizard.js.es6 b/assets/javascripts/wizard/routes/wizard.js.es6 index 2910ee6d..a2c34f13 100644 --- a/assets/javascripts/wizard/routes/wizard.js.es6 +++ b/assets/javascripts/wizard/routes/wizard.js.es6 @@ -1,5 +1,4 @@ import { findCustomWizard, updateCachedWizard } from "../models/wizard"; -import { ajax } from "wizard/lib/ajax"; import WizardI18n from "../lib/wizard-i18n"; import Route from "@ember/routing/route"; import { scheduleOnce } from "@ember/runloop"; @@ -20,7 +19,7 @@ export default Route.extend({ const title = WizardI18n("wizard.incomplete_submission.title", { date: moment(wizardModel.submission_last_updated_at).format( "MMMM Do YYYY" - ) + ), }); const buttons = [ @@ -49,7 +48,7 @@ export default Route.extend({ }, renderTemplate() { - this.render('wizard/templates/wizard'); + this.render("wizard/templates/wizard"); }, setupController(controller, model) { diff --git a/assets/javascripts/wizard/tests/acceptance/field-test.js.es6 b/assets/javascripts/wizard/tests/acceptance/field-test.js.es6 index f73d1ab7..9300fc09 100644 --- a/assets/javascripts/wizard/tests/acceptance/field-test.js.es6 +++ b/assets/javascripts/wizard/tests/acceptance/field-test.js.es6 @@ -1,135 +1,173 @@ -import { - visit, - click, - fillIn, - triggerKeyEvent -} from "@ember/test-helpers"; +import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { exists } from "../helpers/test"; import acceptance, { - query, count, + query, + server, visible, - server } from "../helpers/acceptance"; -import { - allFieldsWizard, - getWizard -} from "../helpers/wizard"; +import { allFieldsWizard, getWizard } from "../helpers/wizard"; import tagsJson from "../fixtures/tags"; import usersJson from "../fixtures/users"; import { response } from "../pretender"; -acceptance("Field | Fields", [ getWizard(allFieldsWizard) ], - function(hooks) { - test("Text", async function (assert) { - await visit("/wizard"); - assert.ok(exists(".wizard-field.text-field input.wizard-focusable")); - }); +acceptance("Field | Fields", [getWizard(allFieldsWizard)], function () { + test("Text", async function (assert) { + await visit("/wizard"); + assert.ok(exists(".wizard-field.text-field input.wizard-focusable")); + }); - test("Textarea", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.textarea-field textarea.wizard-focusable")); - }); + test("Textarea", async function (assert) { + await visit("/wizard"); + assert.ok( + visible(".wizard-field.textarea-field textarea.wizard-focusable") + ); + }); - test("Composer", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.composer-field .wizard-field-composer textarea")); - assert.strictEqual(count(".wizard-field.composer-field .d-editor-button-bar button"), 8); - assert.ok(visible(".wizard-btn.toggle-preview")); + test("Composer", async function (assert) { + await visit("/wizard"); + assert.ok( + visible(".wizard-field.composer-field .wizard-field-composer textarea") + ); + assert.strictEqual( + count(".wizard-field.composer-field .d-editor-button-bar button"), + 8 + ); + assert.ok(visible(".wizard-btn.toggle-preview")); - await fillIn(".wizard-field.composer-field .wizard-field-composer textarea", "Input in composer"); - await click(".wizard-btn.toggle-preview"); - assert.strictEqual(query('.wizard-field.composer-field .wizard-field-composer .d-editor-preview-wrapper p').textContent.trim(), "Input in composer"); - }); + await fillIn( + ".wizard-field.composer-field .wizard-field-composer textarea", + "Input in composer" + ); + await click(".wizard-btn.toggle-preview"); + assert.strictEqual( + query( + ".wizard-field.composer-field .wizard-field-composer .d-editor-preview-wrapper p" + ).textContent.trim(), + "Input in composer" + ); + }); - test("Text Only", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.text-only-field label.field-label")); - }); + test("Text Only", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.text-only-field label.field-label")); + }); - test("Date", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.date-field input.date-picker")); - await click(".wizard-field.date-field input.date-picker"); - assert.ok(visible(".wizard-field.date-field .pika-single")); - }); + test("Date", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.date-field input.date-picker")); + await click(".wizard-field.date-field input.date-picker"); + assert.ok(visible(".wizard-field.date-field .pika-single")); + }); - test("Time", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.time-field .d-time-input .select-kit")); - await click(".wizard-field.time-field .d-time-input .select-kit .select-kit-header"); - assert.ok(visible(".wizard-field.time-field .select-kit-collection")); - }); + test("Time", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.time-field .d-time-input .select-kit")); + await click( + ".wizard-field.time-field .d-time-input .select-kit .select-kit-header" + ); + assert.ok(visible(".wizard-field.time-field .select-kit-collection")); + }); - test("Date Time", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.date-time-field .d-date-time-input .select-kit")); - await click(".wizard-field.date-time-field .d-date-input input.date-picker"); - assert.ok(visible(".wizard-field.date-time-field .d-date-input .pika-single")); - await click(".wizard-field.date-time-field .d-time-input .select-kit .select-kit-header"); - assert.ok(visible(".wizard-field.date-time-field .select-kit-collection")); - }); + test("Date Time", async function (assert) { + await visit("/wizard"); + assert.ok( + visible(".wizard-field.date-time-field .d-date-time-input .select-kit") + ); + await click( + ".wizard-field.date-time-field .d-date-input input.date-picker" + ); + assert.ok( + visible(".wizard-field.date-time-field .d-date-input .pika-single") + ); + await click( + ".wizard-field.date-time-field .d-time-input .select-kit .select-kit-header" + ); + assert.ok(visible(".wizard-field.date-time-field .select-kit-collection")); + }); - test("Number", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.number-field input[type='number']")); - }); + test("Number", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.number-field input[type='number']")); + }); - test("Checkbox", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.checkbox-field input[type='checkbox']")); - }); + test("Checkbox", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.checkbox-field input[type='checkbox']")); + }); - test("Url", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.url-field input[type='text']")); - }); + test("Url", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.url-field input[type='text']")); + }); - test("Upload", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.upload-field label.wizard-btn-upload-file")); - assert.ok(exists(".wizard-field.upload-field input.hidden-upload-field")); - }); + test("Upload", async function (assert) { + await visit("/wizard"); + assert.ok( + visible(".wizard-field.upload-field label.wizard-btn-upload-file") + ); + assert.ok(exists(".wizard-field.upload-field input.hidden-upload-field")); + }); - test("Dropdown", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.dropdown-field .single-select-header")); - await click(".wizard-field.dropdown-field .select-kit-header"); - assert.strictEqual(count(".wizard-field.dropdown-field .select-kit-collection li"), 3); - }); + test("Dropdown", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.dropdown-field .single-select-header")); + await click(".wizard-field.dropdown-field .select-kit-header"); + assert.strictEqual( + count(".wizard-field.dropdown-field .select-kit-collection li"), + 3 + ); + }); - test("Tag", async function (assert) { - server.get("/tags/filter/search", () => (response(200, { results: tagsJson['tags']}))); - await visit("/wizard"); - assert.ok(visible(".wizard-field.tag-field .multi-select-header")); - await click(".wizard-field.tag-field .select-kit-header"); - assert.strictEqual(count(".wizard-field.tag-field .select-kit-collection li"), 2); - }); + test("Tag", async function (assert) { + server.get("/tags/filter/search", () => + response(200, { results: tagsJson["tags"] }) + ); + await visit("/wizard"); + assert.ok(visible(".wizard-field.tag-field .multi-select-header")); + await click(".wizard-field.tag-field .select-kit-header"); + assert.strictEqual( + count(".wizard-field.tag-field .select-kit-collection li"), + 2 + ); + }); - test("Category", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.category-field .multi-select-header")); - await click(".wizard-field.category-field .select-kit-header"); - assert.strictEqual(count(".wizard-field.category-field .select-kit-collection li"), 5); - }); + test("Category", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.category-field .multi-select-header")); + await click(".wizard-field.category-field .select-kit-header"); + assert.strictEqual( + count(".wizard-field.category-field .select-kit-collection li"), + 5 + ); + }); - test("Group", async function (assert) { - await visit("/wizard"); - assert.ok(visible(".wizard-field.group-field .single-select-header")); - await click(".wizard-field.group-field .select-kit-header"); - assert.strictEqual(count(".wizard-field.group-field .select-kit-collection li"), 10); - }); + test("Group", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-field.group-field .single-select-header")); + await click(".wizard-field.group-field .select-kit-header"); + assert.strictEqual( + count(".wizard-field.group-field .select-kit-collection li"), + 10 + ); + }); - test("User", async function (assert) { - server.get("/u/search/users", () => (response(200, usersJson))); + test("User", async function (assert) { + server.get("/u/search/users", () => response(200, usersJson)); - await visit("/wizard"); - await fillIn(".wizard-field.user-selector-field input.ember-text-field", "a"); - await triggerKeyEvent(".wizard-field.user-selector-field input.ember-text-field", "keyup", "a".charCodeAt(0)); + await visit("/wizard"); + await fillIn( + ".wizard-field.user-selector-field input.ember-text-field", + "a" + ); + await triggerKeyEvent( + ".wizard-field.user-selector-field input.ember-text-field", + "keyup", + "a".charCodeAt(0) + ); - assert.ok(visible(".wizard-field.user-selector-field .ac-wrap")); - // TODO: add assertion for ac results. autocomplete does not appear in time. - }); - } -); + assert.ok(visible(".wizard-field.user-selector-field .ac-wrap")); + // TODO: add assertion for ac results. autocomplete does not appear in time. + }); +}); diff --git a/assets/javascripts/wizard/tests/acceptance/step-test.js.es6 b/assets/javascripts/wizard/tests/acceptance/step-test.js.es6 index 731c9b76..1537f1c7 100644 --- a/assets/javascripts/wizard/tests/acceptance/step-test.js.es6 +++ b/assets/javascripts/wizard/tests/acceptance/step-test.js.es6 @@ -1,47 +1,41 @@ -import { visit, click } from "@ember/test-helpers"; +import { click, visit } from "@ember/test-helpers"; import { test } from "qunit"; import { exists } from "../helpers/test"; -import acceptance, { - query, - count, - visible -} from "../helpers/acceptance"; -import { - stepNotPermitted, - wizard, - getWizard -} from "../helpers/wizard"; -import { - saveStep, - update -} from "../helpers/step"; +import acceptance, { count, query, visible } from "../helpers/acceptance"; +import { getWizard, stepNotPermitted, wizard } from "../helpers/wizard"; +import { saveStep, update } from "../helpers/step"; -acceptance("Step | Not permitted", [ getWizard(stepNotPermitted) ], - function(hooks) { - test("Shows not permitted message", async function (assert) { - await visit("/wizard"); - assert.ok(exists(".step-message.not-permitted")); - }); - } -); +acceptance("Step | Not permitted", [getWizard(stepNotPermitted)], function () { + test("Shows not permitted message", async function (assert) { + await visit("/wizard"); + assert.ok(exists(".step-message.not-permitted")); + }); +}); -acceptance("Step | Step", [ getWizard(wizard), saveStep(update) ], - function(hooks) { - test("Renders the step", async function (assert) { - await visit("/wizard"); - assert.strictEqual(query('.wizard-step-title p').textContent.trim(), "Text"); - assert.strictEqual(query('.wizard-step-description p').textContent.trim(), "Text inputs!"); - assert.strictEqual(query('.wizard-step-description p').textContent.trim(), "Text inputs!"); - assert.strictEqual(count('.wizard-step-form .wizard-field'), 6); - assert.ok(visible('.wizard-step-footer .wizard-progress'), true); - assert.ok(visible('.wizard-step-footer .wizard-buttons'), true); - }); +acceptance("Step | Step", [getWizard(wizard), saveStep(update)], function () { + test("Renders the step", async function (assert) { + await visit("/wizard"); + assert.strictEqual( + query(".wizard-step-title p").textContent.trim(), + "Text" + ); + assert.strictEqual( + query(".wizard-step-description p").textContent.trim(), + "Text inputs!" + ); + assert.strictEqual( + query(".wizard-step-description p").textContent.trim(), + "Text inputs!" + ); + assert.strictEqual(count(".wizard-step-form .wizard-field"), 6); + assert.ok(visible(".wizard-step-footer .wizard-progress"), true); + assert.ok(visible(".wizard-step-footer .wizard-buttons"), true); + }); - test("Goes to the next step", async function (assert) { - await visit("/wizard"); - assert.ok(visible('.wizard-step.step_1'), true); - await click('.wizard-btn.next'); - assert.ok(visible('.wizard-step.step_2'), true); - }); - } -); + test("Goes to the next step", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-step.step_1"), true); + await click(".wizard-btn.next"); + assert.ok(visible(".wizard-step.step_2"), true); + }); +}); diff --git a/assets/javascripts/wizard/tests/acceptance/wizard-test.js.es6 b/assets/javascripts/wizard/tests/acceptance/wizard-test.js.es6 index e68f59ae..8fd82d11 100644 --- a/assets/javascripts/wizard/tests/acceptance/wizard-test.js.es6 +++ b/assets/javascripts/wizard/tests/acceptance/wizard-test.js.es6 @@ -1,30 +1,26 @@ import { visit } from "@ember/test-helpers"; import { test } from "qunit"; import { exists } from "../helpers/test"; -import acceptance, { - query, - count, - visible -} from "../helpers/acceptance"; +import acceptance, { count, query, visible } from "../helpers/acceptance"; import { + getWizard, + wizard, + wizardCompleted, wizardNoUser, wizardNotPermitted, - wizardCompleted, - wizard, - getWizard } from "../helpers/wizard"; -acceptance("Wizard | Not logged in", [ getWizard(wizardNoUser) ], - function(hooks) { - test("Wizard no access requires login", async function (assert) { - await visit("/wizard"); - assert.ok(exists(".wizard-no-access.requires-login")); - }); - } -); +acceptance("Wizard | Not logged in", [getWizard(wizardNoUser)], function () { + test("Wizard no access requires login", async function (assert) { + await visit("/wizard"); + assert.ok(exists(".wizard-no-access.requires-login")); + }); +}); -acceptance("Wizard | Not permitted", [ getWizard(wizardNotPermitted) ], - function(hooks) { +acceptance( + "Wizard | Not permitted", + [getWizard(wizardNotPermitted)], + function () { test("Wizard no access not permitted", async function (assert) { await visit("/wizard"); assert.ok(exists(".wizard-no-access.not-permitted")); @@ -32,41 +28,46 @@ acceptance("Wizard | Not permitted", [ getWizard(wizardNotPermitted) ], } ); -acceptance("Wizard | Completed", [ getWizard(wizardCompleted) ], - function(hooks) { - test("Wizard no access completed", async function (assert) { - await visit("/wizard"); - assert.ok(exists(".wizard-no-access.completed")); - }); - } -); +acceptance("Wizard | Completed", [getWizard(wizardCompleted)], function () { + test("Wizard no access completed", async function (assert) { + await visit("/wizard"); + assert.ok(exists(".wizard-no-access.completed")); + }); +}); -acceptance("Wizard | Wizard", [ getWizard(wizard) ], - function(hooks) { - test("Starts", async function (assert) { - await visit("/wizard"); - assert.ok(query('.wizard-column'), true); - }); +acceptance("Wizard | Wizard", [getWizard(wizard)], function () { + test("Starts", async function (assert) { + await visit("/wizard"); + assert.ok(query(".wizard-column"), true); + }); - test("Applies the body background color", async function (assert) { - await visit("/wizard"); - assert.ok($("body")[0].style.background); - }); + test("Applies the body background color", async function (assert) { + await visit("/wizard"); + assert.ok($("body")[0].style.background); + }); - test("Renders the wizard form", async function (assert) { - await visit("/wizard"); - assert.ok(visible('.wizard-column-contents .wizard-step'), true); - assert.ok(visible('.wizard-footer img'), true); - }); + test("Renders the wizard form", async function (assert) { + await visit("/wizard"); + assert.ok(visible(".wizard-column-contents .wizard-step"), true); + assert.ok(visible(".wizard-footer img"), true); + }); - test("Renders the first step", async function (assert) { - await visit("/wizard"); - assert.strictEqual(query('.wizard-step-title p').textContent.trim(), "Text"); - assert.strictEqual(query('.wizard-step-description p').textContent.trim(), "Text inputs!"); - assert.strictEqual(query('.wizard-step-description p').textContent.trim(), "Text inputs!"); - assert.strictEqual(count('.wizard-step-form .wizard-field'), 6); - assert.ok(visible('.wizard-step-footer .wizard-progress'), true); - assert.ok(visible('.wizard-step-footer .wizard-buttons'), true); - }); - } -); + test("Renders the first step", async function (assert) { + await visit("/wizard"); + assert.strictEqual( + query(".wizard-step-title p").textContent.trim(), + "Text" + ); + assert.strictEqual( + query(".wizard-step-description p").textContent.trim(), + "Text inputs!" + ); + assert.strictEqual( + query(".wizard-step-description p").textContent.trim(), + "Text inputs!" + ); + assert.strictEqual(count(".wizard-step-form .wizard-field"), 6); + assert.ok(visible(".wizard-step-footer .wizard-progress"), true); + assert.ok(visible(".wizard-step-footer .wizard-buttons"), true); + }); +}); diff --git a/assets/javascripts/wizard/tests/bootstrap.js.es6 b/assets/javascripts/wizard/tests/bootstrap.js.es6 index 29cdfe80..a3343b9a 100644 --- a/assets/javascripts/wizard/tests/bootstrap.js.es6 +++ b/assets/javascripts/wizard/tests/bootstrap.js.es6 @@ -1,5 +1,5 @@ // discourse-skip-module -/*global document, Logster, QUnit */ +/*global document, Logster */ if (window.location.pathname.indexOf("/w/") > -1 && Ember.testing) { document.addEventListener("DOMContentLoaded", function () { diff --git a/assets/javascripts/wizard/tests/fixtures/categories.js.es6 b/assets/javascripts/wizard/tests/fixtures/categories.js.es6 index e862f54a..e553f860 100644 --- a/assets/javascripts/wizard/tests/fixtures/categories.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/categories.js.es6 @@ -1,209 +1,221 @@ export default { - "categories": [ + categories: [ { - "id": 1, - "name": "Uncategorized", - "color": "0088CC", - "text_color": "FFFFFF", - "slug": "uncategorized", - "topic_count": 1, - "post_count": 1, - "position": 0, - "description": "Topics that don't need a category, or don't fit into any other existing category.", - "description_text": "Topics that don't need a category, or don't fit into any other existing category.", - "description_excerpt": "Topics that don't need a category, or don't fit into any other existing category.", - "topic_url": "/t/", - "read_restricted": false, - "permission": 1, - "notification_level": 0, - "topic_template": null, - "has_children": false, - "sort_order": null, - "sort_ascending": null, - "show_subcategory_list": false, - "num_featured_topics": 3, - "default_view": null, - "subcategory_list_style": "rows_with_featured_topics", - "default_top_period": "all", - "default_list_filter": "all", - "minimum_required_tags": 0, - "navigate_to_first_post_after_read": false, - "custom_fields": { - "create_topic_wizard": null + id: 1, + name: "Uncategorized", + color: "0088CC", + text_color: "FFFFFF", + slug: "uncategorized", + topic_count: 1, + post_count: 1, + position: 0, + description: + "Topics that don't need a category, or don't fit into any other existing category.", + description_text: + "Topics that don't need a category, or don't fit into any other existing category.", + description_excerpt: + "Topics that don't need a category, or don't fit into any other existing category.", + topic_url: "/t/", + read_restricted: false, + permission: 1, + notification_level: 0, + topic_template: null, + has_children: false, + sort_order: null, + sort_ascending: null, + show_subcategory_list: false, + num_featured_topics: 3, + default_view: null, + subcategory_list_style: "rows_with_featured_topics", + default_top_period: "all", + default_list_filter: "all", + minimum_required_tags: 0, + navigate_to_first_post_after_read: false, + custom_fields: { + create_topic_wizard: null, }, - "allowed_tags": [], - "allowed_tag_groups": [], - "allow_global_tags": false, - "min_tags_from_required_group": 1, - "required_tag_group_name": null, - "read_only_banner": null, - "uploaded_logo": null, - "uploaded_background": null, - "can_edit": true + allowed_tags: [], + allowed_tag_groups: [], + allow_global_tags: false, + min_tags_from_required_group: 1, + required_tag_group_name: null, + read_only_banner: null, + uploaded_logo: null, + uploaded_background: null, + can_edit: true, }, { - "id": 2, - "name": "Site Feedback", - "color": "808281", - "text_color": "FFFFFF", - "slug": "site-feedback", - "topic_count": 20, - "post_count": 21, - "position": 1, - "description": "

Discussion about this site, its organization, how it works, and how we can improve it.

", - "description_text": "Discussion about this site, its organization, how it works, and how we can improve it.", - "description_excerpt": "Discussion about this site, its organization, how it works, and how we can improve it.", - "topic_url": "/t/about-the-site-feedback-category/1", - "read_restricted": false, - "permission": 1, - "notification_level": 0, - "topic_template": null, - "has_children": false, - "sort_order": null, - "sort_ascending": null, - "show_subcategory_list": false, - "num_featured_topics": 3, - "default_view": null, - "subcategory_list_style": "rows_with_featured_topics", - "default_top_period": "all", - "default_list_filter": "all", - "minimum_required_tags": 0, - "navigate_to_first_post_after_read": false, - "custom_fields": { - "create_topic_wizard": null + id: 2, + name: "Site Feedback", + color: "808281", + text_color: "FFFFFF", + slug: "site-feedback", + topic_count: 20, + post_count: 21, + position: 1, + description: + "

Discussion about this site, its organization, how it works, and how we can improve it.

", + description_text: + "Discussion about this site, its organization, how it works, and how we can improve it.", + description_excerpt: + "Discussion about this site, its organization, how it works, and how we can improve it.", + topic_url: "/t/about-the-site-feedback-category/1", + read_restricted: false, + permission: 1, + notification_level: 0, + topic_template: null, + has_children: false, + sort_order: null, + sort_ascending: null, + show_subcategory_list: false, + num_featured_topics: 3, + default_view: null, + subcategory_list_style: "rows_with_featured_topics", + default_top_period: "all", + default_list_filter: "all", + minimum_required_tags: 0, + navigate_to_first_post_after_read: false, + custom_fields: { + create_topic_wizard: null, }, - "allowed_tags": [], - "allowed_tag_groups": [], - "allow_global_tags": false, - "min_tags_from_required_group": 1, - "required_tag_group_name": null, - "read_only_banner": null, - "uploaded_logo": null, - "uploaded_background": null, - "can_edit": true + allowed_tags: [], + allowed_tag_groups: [], + allow_global_tags: false, + min_tags_from_required_group: 1, + required_tag_group_name: null, + read_only_banner: null, + uploaded_logo: null, + uploaded_background: null, + can_edit: true, }, { - "id": 3, - "name": "Staff", - "color": "E45735", - "text_color": "FFFFFF", - "slug": "staff", - "topic_count": 4, - "post_count": 7, - "position": 2, - "description": "

Private category for staff discussions. Topics are only visible to admins and moderators.

", - "description_text": "Private category for staff discussions. Topics are only visible to admins and moderators.", - "description_excerpt": "Private category for staff discussions. Topics are only visible to admins and moderators.", - "topic_url": "/t/about-the-staff-category/2", - "read_restricted": true, - "permission": 1, - "notification_level": 0, - "topic_template": null, - "has_children": false, - "sort_order": null, - "sort_ascending": null, - "show_subcategory_list": false, - "num_featured_topics": 3, - "default_view": null, - "subcategory_list_style": "rows_with_featured_topics", - "default_top_period": "all", - "default_list_filter": "all", - "minimum_required_tags": 0, - "navigate_to_first_post_after_read": false, - "custom_fields": { - "create_topic_wizard": null + id: 3, + name: "Staff", + color: "E45735", + text_color: "FFFFFF", + slug: "staff", + topic_count: 4, + post_count: 7, + position: 2, + description: + "

Private category for staff discussions. Topics are only visible to admins and moderators.

", + description_text: + "Private category for staff discussions. Topics are only visible to admins and moderators.", + description_excerpt: + "Private category for staff discussions. Topics are only visible to admins and moderators.", + topic_url: "/t/about-the-staff-category/2", + read_restricted: true, + permission: 1, + notification_level: 0, + topic_template: null, + has_children: false, + sort_order: null, + sort_ascending: null, + show_subcategory_list: false, + num_featured_topics: 3, + default_view: null, + subcategory_list_style: "rows_with_featured_topics", + default_top_period: "all", + default_list_filter: "all", + minimum_required_tags: 0, + navigate_to_first_post_after_read: false, + custom_fields: { + create_topic_wizard: null, }, - "allowed_tags": [], - "allowed_tag_groups": [], - "allow_global_tags": false, - "min_tags_from_required_group": 1, - "required_tag_group_name": null, - "read_only_banner": null, - "uploaded_logo": null, - "uploaded_background": null, - "can_edit": true + allowed_tags: [], + allowed_tag_groups: [], + allow_global_tags: false, + min_tags_from_required_group: 1, + required_tag_group_name: null, + read_only_banner: null, + uploaded_logo: null, + uploaded_background: null, + can_edit: true, }, { - "id": 4, - "name": "Lounge", - "color": "A461EF", - "text_color": "652D90", - "slug": "lounge", - "topic_count": 1, - "post_count": 1, - "position": 3, - "description": "

A category exclusive to members with trust level 3 and higher.

", - "description_text": "A category exclusive to members with trust level 3 and higher.", - "description_excerpt": "A category exclusive to members with trust level 3 and higher.", - "topic_url": "/t/about-the-lounge-category/3", - "read_restricted": true, - "permission": 1, - "notification_level": 0, - "topic_template": null, - "has_children": false, - "sort_order": null, - "sort_ascending": null, - "show_subcategory_list": false, - "num_featured_topics": 3, - "default_view": null, - "subcategory_list_style": "rows_with_featured_topics", - "default_top_period": "all", - "default_list_filter": "all", - "minimum_required_tags": 0, - "navigate_to_first_post_after_read": false, - "custom_fields": { - "create_topic_wizard": null + id: 4, + name: "Lounge", + color: "A461EF", + text_color: "652D90", + slug: "lounge", + topic_count: 1, + post_count: 1, + position: 3, + description: + "

A category exclusive to members with trust level 3 and higher.

", + description_text: + "A category exclusive to members with trust level 3 and higher.", + description_excerpt: + "A category exclusive to members with trust level 3 and higher.", + topic_url: "/t/about-the-lounge-category/3", + read_restricted: true, + permission: 1, + notification_level: 0, + topic_template: null, + has_children: false, + sort_order: null, + sort_ascending: null, + show_subcategory_list: false, + num_featured_topics: 3, + default_view: null, + subcategory_list_style: "rows_with_featured_topics", + default_top_period: "all", + default_list_filter: "all", + minimum_required_tags: 0, + navigate_to_first_post_after_read: false, + custom_fields: { + create_topic_wizard: null, }, - "allowed_tags": [], - "allowed_tag_groups": [], - "allow_global_tags": false, - "min_tags_from_required_group": 1, - "required_tag_group_name": null, - "read_only_banner": null, - "uploaded_logo": null, - "uploaded_background": null, - "can_edit": true + allowed_tags: [], + allowed_tag_groups: [], + allow_global_tags: false, + min_tags_from_required_group: 1, + required_tag_group_name: null, + read_only_banner: null, + uploaded_logo: null, + uploaded_background: null, + can_edit: true, }, { - "id": 5, - "name": "Custom Categories", - "color": "0088CC", - "text_color": "FFFFFF", - "slug": "custom-category", - "topic_count": 0, - "post_count": 0, - "position": 10, - "description": "Description of custom category", - "description_text": "Description of custom category", - "description_excerpt": "Description of custom category", - "topic_url": "/t/about-the-custom-category/5", - "read_restricted": false, - "permission": 1, - "notification_level": 0, - "topic_template": null, - "has_children": false, - "sort_order": null, - "sort_ascending": null, - "show_subcategory_list": false, - "num_featured_topics": 3, - "default_view": null, - "subcategory_list_style": "rows_with_featured_topics", - "default_top_period": "all", - "default_list_filter": "all", - "minimum_required_tags": 0, - "navigate_to_first_post_after_read": false, - "custom_fields": { - "create_topic_wizard": null + id: 5, + name: "Custom Categories", + color: "0088CC", + text_color: "FFFFFF", + slug: "custom-category", + topic_count: 0, + post_count: 0, + position: 10, + description: "Description of custom category", + description_text: "Description of custom category", + description_excerpt: "Description of custom category", + topic_url: "/t/about-the-custom-category/5", + read_restricted: false, + permission: 1, + notification_level: 0, + topic_template: null, + has_children: false, + sort_order: null, + sort_ascending: null, + show_subcategory_list: false, + num_featured_topics: 3, + default_view: null, + subcategory_list_style: "rows_with_featured_topics", + default_top_period: "all", + default_list_filter: "all", + minimum_required_tags: 0, + navigate_to_first_post_after_read: false, + custom_fields: { + create_topic_wizard: null, }, - "allowed_tags": [], - "allowed_tag_groups": [], - "allow_global_tags": false, - "min_tags_from_required_group": 1, - "required_tag_group_name": null, - "read_only_banner": null, - "uploaded_logo": null, - "uploaded_background": null, - "can_edit": true - } - ] -} + allowed_tags: [], + allowed_tag_groups: [], + allow_global_tags: false, + min_tags_from_required_group: 1, + required_tag_group_name: null, + read_only_banner: null, + uploaded_logo: null, + uploaded_background: null, + can_edit: true, + }, + ], +}; diff --git a/assets/javascripts/wizard/tests/fixtures/groups.js.es6 b/assets/javascripts/wizard/tests/fixtures/groups.js.es6 index 16f8150d..a770cf58 100644 --- a/assets/javascripts/wizard/tests/fixtures/groups.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/groups.js.es6 @@ -1,313 +1,313 @@ export default { - "groups": [ + groups: [ { - "id": 1, - "automatic": true, - "name": "admins", - "display_name": "admins", - "user_count": 1, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 1, + automatic: true, + name: "admins", + display_name: "admins", + user_count: 1, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 0, - "automatic": true, - "name": "everyone", - "display_name": "everyone", - "user_count": 0, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 3, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 0, + automatic: true, + name: "everyone", + display_name: "everyone", + user_count: 0, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 3, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 15, - "automatic": false, - "name": "custom_group", - "user_count": 1, - "mentionable_level": 1, - "messageable_level": 2, - "visibility_level": 3, - "primary_group": false, - "title": "Custom Group", - "grant_trust_level": 3, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": "I am prefilled", - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 99, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 15, + automatic: false, + name: "custom_group", + user_count: 1, + mentionable_level: 1, + messageable_level: 2, + visibility_level: 3, + primary_group: false, + title: "Custom Group", + grant_trust_level: 3, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: "I am prefilled", + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 99, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 2, - "automatic": true, - "name": "moderators", - "display_name": "moderators", - "user_count": 0, - "mentionable_level": 0, - "messageable_level": 99, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 2, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 2, + automatic: true, + name: "moderators", + display_name: "moderators", + user_count: 0, + mentionable_level: 0, + messageable_level: 99, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 2, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 3, - "automatic": true, - "name": "staff", - "display_name": "staff", - "user_count": 1, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 3, + automatic: true, + name: "staff", + display_name: "staff", + user_count: 1, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 10, - "automatic": true, - "name": "trust_level_0", - "display_name": "trust_level_0", - "user_count": 2, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 10, + automatic: true, + name: "trust_level_0", + display_name: "trust_level_0", + user_count: 2, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 11, - "automatic": true, - "name": "trust_level_1", - "display_name": "trust_level_1", - "user_count": 2, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 11, + automatic: true, + name: "trust_level_1", + display_name: "trust_level_1", + user_count: 2, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 12, - "automatic": true, - "name": "trust_level_2", - "display_name": "trust_level_2", - "user_count": 1, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 12, + automatic: true, + name: "trust_level_2", + display_name: "trust_level_2", + user_count: 1, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 13, - "automatic": true, - "name": "trust_level_3", - "display_name": "trust_level_3", - "user_count": 1, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false + id: 13, + automatic: true, + name: "trust_level_3", + display_name: "trust_level_3", + user_count: 1, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, }, { - "id": 14, - "automatic": true, - "name": "trust_level_4", - "display_name": "trust_level_4", - "user_count": 0, - "mentionable_level": 0, - "messageable_level": 0, - "visibility_level": 1, - "primary_group": false, - "title": null, - "grant_trust_level": null, - "incoming_email": null, - "has_messages": false, - "flair_url": null, - "flair_bg_color": null, - "flair_color": null, - "bio_raw": null, - "bio_cooked": null, - "bio_excerpt": null, - "public_admission": false, - "public_exit": false, - "allow_membership_requests": false, - "full_name": null, - "default_notification_level": 3, - "membership_request_template": null, - "members_visibility_level": 0, - "can_see_members": true, - "can_admin_group": true, - "publish_read_state": false - } - ] -} + id: 14, + automatic: true, + name: "trust_level_4", + display_name: "trust_level_4", + user_count: 0, + mentionable_level: 0, + messageable_level: 0, + visibility_level: 1, + primary_group: false, + title: null, + grant_trust_level: null, + incoming_email: null, + has_messages: false, + flair_url: null, + flair_bg_color: null, + flair_color: null, + bio_raw: null, + bio_cooked: null, + bio_excerpt: null, + public_admission: false, + public_exit: false, + allow_membership_requests: false, + full_name: null, + default_notification_level: 3, + membership_request_template: null, + members_visibility_level: 0, + can_see_members: true, + can_admin_group: true, + publish_read_state: false, + }, + ], +}; diff --git a/assets/javascripts/wizard/tests/fixtures/site-settings.js.es6 b/assets/javascripts/wizard/tests/fixtures/site-settings.js.es6 index f71ace8e..7568cd49 100644 --- a/assets/javascripts/wizard/tests/fixtures/site-settings.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/site-settings.js.es6 @@ -1,283 +1,294 @@ export default { - "default_locale": "en", - "title": "Discourse", - "short_site_description": "", - "exclude_rel_nofollow_domains": "", - "logo": "/images/discourse-logo-sketch.png", - "logo_small": "/images/discourse-logo-sketch-small.png", - "digest_logo": "", - "mobile_logo": "", - "logo_dark": "", - "logo_small_dark": "", - "mobile_logo_dark": "", - "large_icon": "", - "favicon": "", - "apple_touch_icon": "", - "display_local_time_in_user_card": false, - "allow_user_locale": false, - "set_locale_from_accept_language_header": false, - "support_mixed_text_direction": false, - "suggested_topics": 5, - "ga_universal_tracking_code": "", - "ga_universal_domain_name": "auto", - "gtm_container_id": "", - "top_menu": "categories|latest", - "post_menu": "read|like|share|flag|edit|bookmark|delete|admin|reply", - "post_menu_hidden_items": "flag|bookmark|edit|delete|admin", - "share_links": "twitter|facebook|email", - "share_quote_visibility": "anonymous", - "share_quote_buttons": "twitter|email", - "desktop_category_page_style": "categories_and_latest_topics", - "category_colors": "BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|E45735", - "category_style": "bullet", - "max_category_nesting": 2, - "enable_mobile_theme": true, - "enable_direct_s3_uploads": false, - "enable_upload_debug_mode": false, - "default_dark_mode_color_scheme_id": 1, - "relative_date_duration": 30, - "fixed_category_positions": false, - "fixed_category_positions_on_create": false, - "enable_badges": true, - "enable_badge_sql": true, - "max_favorite_badges": 2, - "enable_whispers": false, - "enable_bookmarks_with_reminders": true, - "push_notifications_prompt": true, - "vapid_public_key_bytes": "4|29|219|88|202|66|198|62|182|204|66|176|229|200|131|26|141|21|178|231|150|161|2|128|228|200|179|126|118|232|196|19|232|76|108|189|54|211|210|155|55|228|173|112|38|158|114|127|18|95|7|56|110|183|192|92|43|0|243|249|233|89|9|207|255", - "invite_only": false, - "login_required": false, - "must_approve_users": false, - "enable_local_logins": true, - "enable_local_logins_via_email": true, - "allow_new_registrations": true, - "enable_signup_cta": true, - "facebook_app_id": "", - "auth_skip_create_confirm": false, - "auth_overrides_email": false, - "enable_discourse_connect": true, - "discourse_connect_overrides_avatar": false, - "hide_email_address_taken": false, - "min_username_length": 3, - "max_username_length": 20, - "unicode_usernames": false, - "min_password_length": 10, - "min_admin_password_length": 15, - "email_editable": true, - "logout_redirect": "", - "full_name_required": false, - "enable_names": true, - "invite_expiry_days": 90, - "invites_per_page": 40, - "delete_user_max_post_age": 60, - "delete_all_posts_max": 15, - "prioritize_username_in_ux": true, - "enable_user_directory": true, - "allow_anonymous_posting": false, - "anonymous_posting_min_trust_level": 1, - "allow_users_to_hide_profile": true, - "hide_user_profiles_from_public": false, - "allow_featured_topic_on_user_profiles": true, - "hide_suspension_reasons": false, - "ignored_users_count_message_threshold": 5, - "ignored_users_message_gap_days": 365, - "user_selected_primary_groups": false, - "gravatar_name": "Gravatar", - "gravatar_base_url": "www.gravatar.com", - "gravatar_login_url": "/emails", - "enable_group_directory": true, - "enable_category_group_moderation": false, - "min_post_length": 20, - "min_first_post_length": 20, - "min_personal_message_post_length": 10, - "max_post_length": 32000, - "topic_featured_link_enabled": true, - "min_topic_views_for_delete_confirm": 5000, - "min_topic_title_length": 15, - "max_topic_title_length": 255, - "enable_filtered_replies_view": false, - "min_personal_message_title_length": 2, - "allow_uncategorized_topics": true, - "min_title_similar_length": 10, - "enable_personal_messages": true, - "edit_history_visible_to_public": true, - "delete_removed_posts_after": 24, - "traditional_markdown_linebreaks": false, - "enable_markdown_typographer": true, - "enable_markdown_linkify": true, - "markdown_linkify_tlds": "com|net|org|io|onion|co|tv|ru|cn|us|uk|me|de|fr|fi|gov", - "markdown_typographer_quotation_marks": "“|”|‘|’", - "enable_rich_text_paste": true, - "suppress_reply_directly_below": true, - "suppress_reply_directly_above": true, - "max_reply_history": 1, - "enable_mentions": true, - "here_mention": "here", - "newuser_max_embedded_media": 1, - "newuser_max_attachments": 0, - "show_pinned_excerpt_mobile": true, - "show_pinned_excerpt_desktop": true, - "display_name_on_posts": false, - "show_time_gap_days": 7, - "short_progress_text_threshold": 10000, - "default_code_lang": "auto", - "autohighlight_all_code": false, - "highlighted_languages": "apache|bash|cs|cpp|css|coffeescript|diff|xml|http|ini|json|java|javascript|makefile|markdown|nginx|objectivec|ruby|perl|php|python|sql|handlebars", - "show_copy_button_on_codeblocks": false, - "enable_emoji": true, - "enable_emoji_shortcuts": true, - "emoji_set": "twitter", - "emoji_autocomplete_min_chars": 0, - "enable_inline_emoji_translation": false, - "code_formatting_style": "code-fences", - "allowed_href_schemes": "", - "watched_words_regular_expressions": false, - "enable_diffhtml_preview": false, - "enable_fast_edit": true, - "old_post_notice_days": 14, - "blur_tl0_flagged_posts_media": true, - "email_time_window_mins": 10, - "disable_digest_emails": false, - "email_in": false, - "enable_imap": false, - "enable_smtp": false, - "disable_emails": "no", - "bounce_score_threshold": 4, - "enable_secondary_emails": true, - "max_image_size_kb": 4096, - "max_attachment_size_kb": 4096, - "authorized_extensions": "jpg|jpeg|png|gif|heic|heif|webp", - "authorized_extensions_for_staff": "", - "max_image_width": 690, - "max_image_height": 500, - "prevent_anons_from_downloading_files": false, - "secure_media": false, - "enable_s3_uploads": false, - "allow_profile_backgrounds": true, - "allow_uploaded_avatars": "0", - "default_avatars": "", - "external_system_avatars_enabled": true, - "external_system_avatars_url": "/letter_avatar_proxy/v4/letter/{first_letter}/{color}/{size}.png", - "external_emoji_url": "", - "selectable_avatars_mode": "disabled", - "selectable_avatars": "", - "allow_staff_to_upload_any_file_in_pm": true, - "simultaneous_uploads": 5, - "composer_media_optimization_image_enabled": true, - "composer_media_optimization_image_bytes_optimization_threshold": 524288, - "composer_media_optimization_image_resize_dimensions_threshold": 1920, - "composer_media_optimization_image_resize_width_target": 1920, - "composer_media_optimization_image_resize_pre_multiply": false, - "composer_media_optimization_image_resize_linear_rgb": false, - "composer_media_optimization_image_encode_quality": 75, - "composer_media_optimization_debug_mode": false, - "min_trust_level_to_allow_profile_background": 0, - "min_trust_level_to_allow_user_card_background": 0, - "min_trust_level_to_allow_ignore": 2, - "tl1_requires_read_posts": 30, - "tl3_links_no_follow": false, - "enforce_second_factor": "no", - "moderators_change_post_ownership": false, - "moderators_view_emails": false, - "use_admin_ip_allowlist": false, - "allowed_iframes": "https://www.google.com/maps/embed?|https://www.openstreetmap.org/export/embed.html?|https://calendar.google.com/calendar/embed?|https://codepen.io/|https://www.instagram.com|http://localhost:3000/discobot/certificate.svg", - "can_permanently_delete": false, - "max_oneboxes_per_post": 50, - "reviewable_claiming": "disabled", - "reviewable_default_topics": false, - "reviewable_default_visibility": "low", - "alert_admins_if_errors_per_minute": 0, - "alert_admins_if_errors_per_hour": 0, - "max_prints_per_hour_per_user": 5, - "invite_link_max_redemptions_limit": 5000, - "invite_link_max_redemptions_limit_users": 10, - "enable_long_polling": true, - "enable_chunked_encoding": true, - "long_polling_base_url": "/", - "background_polling_interval": 60000, - "polling_interval": 3000, - "anon_polling_interval": 25000, - "flush_timings_secs": 60, - "verbose_localization": false, - "max_new_topics": 500, - "enable_safe_mode": true, - "tos_url": "", - "privacy_policy_url": "", - "faq_url": "", - "enable_backups": true, - "backup_location": "local", - "maximum_backups": 5, - "use_pg_headlines_for_excerpt": false, - "min_search_term_length": 3, - "log_search_queries": true, - "version_checks": true, - "suppress_uncategorized_badge": true, - "header_dropdown_category_count": 8, - "slug_generation_method": "ascii", - "summary_timeline_button": false, - "topic_views_heat_low": 1000, - "topic_views_heat_medium": 2000, - "topic_views_heat_high": 3500, - "topic_post_like_heat_low": 0.5, - "topic_post_like_heat_medium": 1, - "topic_post_like_heat_high": 2, - "history_hours_low": 12, - "history_hours_medium": 24, - "history_hours_high": 48, - "cold_age_days_low": 14, - "cold_age_days_medium": 90, - "cold_age_days_high": 180, - "global_notice": "", - "show_create_topics_notice": true, - "bootstrap_mode_min_users": 50, - "bootstrap_mode_enabled": true, - "automatically_unpin_topics": true, - "read_time_word_count": 500, - "topic_page_title_includes_category": true, - "svg_icon_subset": "", - "allow_bulk_invite": true, - "disable_mailing_list_mode": true, - "default_topics_automatic_unpin": true, - "mute_all_categories_by_default": false, - "tagging_enabled": true, - "tag_style": "simple", - "max_tags_per_topic": 5, - "max_tag_length": 20, - "min_trust_level_to_tag_topics": "0", - "max_tag_search_results": 5, - "max_tags_in_filter_list": 30, - "tags_sort_alphabetically": false, - "tags_listed_by_group": false, - "suppress_overlapping_tags_in_list": false, - "remove_muted_tags_from_latest": "always", - "force_lowercase_tags": true, - "dashboard_hidden_reports": "", - "dashboard_visible_tabs": "moderation|security|reports", - "dashboard_general_tab_activity_metrics": "page_view_total_reqs|visits|time_to_first_response|likes|flags|user_to_user_private_messages_with_replies", - "discourse_narrative_bot_enabled": true, - "details_enabled": true, - "custom_wizard_enabled": true, - "wizard_redirect_exclude_paths": "admin", - "wizard_recognised_image_upload_formats": "jpg|jpeg|png|gif", - "wizard_important_notices_on_dashboard": true, - "discourse_local_dates_email_format": "YYYY-MM-DDTHH:mm:ss[Z]", - "discourse_local_dates_enabled": true, - "discourse_local_dates_default_formats": "LLL|LTS|LL|LLLL", - "discourse_local_dates_default_timezones": "Europe/Paris|America/Los_Angeles", - "poll_enabled": true, - "poll_maximum_options": 20, - "poll_minimum_trust_level_to_create": 1, - "poll_groupable_user_fields": "", - "poll_export_data_explorer_query_id": -16, - "presence_enabled": true, - "presence_max_users_shown": 5, - "available_locales": "[{\"name\":\"اللغة العربية\",\"value\":\"ar\"},{\"name\":\"беларуская мова\",\"value\":\"be\"},{\"name\":\"български език\",\"value\":\"bg\"},{\"name\":\"bosanski jezik\",\"value\":\"bs_BA\"},{\"name\":\"català\",\"value\":\"ca\"},{\"name\":\"čeština\",\"value\":\"cs\"},{\"name\":\"dansk\",\"value\":\"da\"},{\"name\":\"Deutsch\",\"value\":\"de\"},{\"name\":\"ελληνικά\",\"value\":\"el\"},{\"name\":\"English (US)\",\"value\":\"en\"},{\"name\":\"English (UK)\",\"value\":\"en_GB\"},{\"name\":\"Español\",\"value\":\"es\"},{\"name\":\"eesti\",\"value\":\"et\"},{\"name\":\"فارسی\",\"value\":\"fa_IR\"},{\"name\":\"suomi\",\"value\":\"fi\"},{\"name\":\"Français\",\"value\":\"fr\"},{\"name\":\"galego\",\"value\":\"gl\"},{\"name\":\"עברית\",\"value\":\"he\"},{\"name\":\"magyar\",\"value\":\"hu\"},{\"name\":\"Հայերեն\",\"value\":\"hy\"},{\"name\":\"Indonesian\",\"value\":\"id\"},{\"name\":\"Italiano\",\"value\":\"it\"},{\"name\":\"日本語\",\"value\":\"ja\"},{\"name\":\"한국어\",\"value\":\"ko\"},{\"name\":\"lietuvių kalba\",\"value\":\"lt\"},{\"name\":\"latviešu valoda\",\"value\":\"lv\"},{\"name\":\"Norsk bokmål\",\"value\":\"nb_NO\"},{\"name\":\"Nederlands\",\"value\":\"nl\"},{\"name\":\"polski\",\"value\":\"pl_PL\"},{\"name\":\"Português\",\"value\":\"pt\"},{\"name\":\"Português (BR)\",\"value\":\"pt_BR\"},{\"name\":\"limba română\",\"value\":\"ro\"},{\"name\":\"Русский\",\"value\":\"ru\"},{\"name\":\"slovenčina\",\"value\":\"sk\"},{\"name\":\"slovenščina\",\"value\":\"sl\"},{\"name\":\"Shqip\",\"value\":\"sq\"},{\"name\":\"српски језик\",\"value\":\"sr\"},{\"name\":\"svenska\",\"value\":\"sv\"},{\"name\":\"Kiswahili\",\"value\":\"sw\"},{\"name\":\"తెలుగు\",\"value\":\"te\"},{\"name\":\"ไทย\",\"value\":\"th\"},{\"name\":\"Türkçe\",\"value\":\"tr_TR\"},{\"name\":\"українська мова\",\"value\":\"uk\"},{\"name\":\"اردو\",\"value\":\"ur\"},{\"name\":\"Việt Nam\",\"value\":\"vi\"},{\"name\":\"简体中文\",\"value\":\"zh_CN\"},{\"name\":\"繁體中文\",\"value\":\"zh_TW\"}]", - "require_invite_code": false, - "site_logo_url": "http://localhost:3000/images/discourse-logo-sketch.png", - "site_logo_small_url": "http://localhost:3000/images/discourse-logo-sketch-small.png", - "site_mobile_logo_url": "http://localhost:3000/images/discourse-logo-sketch.png", - "site_favicon_url": "http://localhost:3000/uploads/default/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_32x32.png", - "site_logo_dark_url": "", - "site_logo_small_dark_url": "", - "site_mobile_logo_dark_url": "" -} + default_locale: "en", + title: "Discourse", + short_site_description: "", + exclude_rel_nofollow_domains: "", + logo: "/images/discourse-logo-sketch.png", + logo_small: "/images/discourse-logo-sketch-small.png", + digest_logo: "", + mobile_logo: "", + logo_dark: "", + logo_small_dark: "", + mobile_logo_dark: "", + large_icon: "", + favicon: "", + apple_touch_icon: "", + display_local_time_in_user_card: false, + allow_user_locale: false, + set_locale_from_accept_language_header: false, + support_mixed_text_direction: false, + suggested_topics: 5, + ga_universal_tracking_code: "", + ga_universal_domain_name: "auto", + gtm_container_id: "", + top_menu: "categories|latest", + post_menu: "read|like|share|flag|edit|bookmark|delete|admin|reply", + post_menu_hidden_items: "flag|bookmark|edit|delete|admin", + share_links: "twitter|facebook|email", + share_quote_visibility: "anonymous", + share_quote_buttons: "twitter|email", + desktop_category_page_style: "categories_and_latest_topics", + category_colors: + "BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|E45735", + category_style: "bullet", + max_category_nesting: 2, + enable_mobile_theme: true, + enable_direct_s3_uploads: false, + enable_upload_debug_mode: false, + default_dark_mode_color_scheme_id: 1, + relative_date_duration: 30, + fixed_category_positions: false, + fixed_category_positions_on_create: false, + enable_badges: true, + enable_badge_sql: true, + max_favorite_badges: 2, + enable_whispers: false, + enable_bookmarks_with_reminders: true, + push_notifications_prompt: true, + vapid_public_key_bytes: + "4|29|219|88|202|66|198|62|182|204|66|176|229|200|131|26|141|21|178|231|150|161|2|128|228|200|179|126|118|232|196|19|232|76|108|189|54|211|210|155|55|228|173|112|38|158|114|127|18|95|7|56|110|183|192|92|43|0|243|249|233|89|9|207|255", + invite_only: false, + login_required: false, + must_approve_users: false, + enable_local_logins: true, + enable_local_logins_via_email: true, + allow_new_registrations: true, + enable_signup_cta: true, + facebook_app_id: "", + auth_skip_create_confirm: false, + auth_overrides_email: false, + enable_discourse_connect: true, + discourse_connect_overrides_avatar: false, + hide_email_address_taken: false, + min_username_length: 3, + max_username_length: 20, + unicode_usernames: false, + min_password_length: 10, + min_admin_password_length: 15, + email_editable: true, + logout_redirect: "", + full_name_required: false, + enable_names: true, + invite_expiry_days: 90, + invites_per_page: 40, + delete_user_max_post_age: 60, + delete_all_posts_max: 15, + prioritize_username_in_ux: true, + enable_user_directory: true, + allow_anonymous_posting: false, + anonymous_posting_min_trust_level: 1, + allow_users_to_hide_profile: true, + hide_user_profiles_from_public: false, + allow_featured_topic_on_user_profiles: true, + hide_suspension_reasons: false, + ignored_users_count_message_threshold: 5, + ignored_users_message_gap_days: 365, + user_selected_primary_groups: false, + gravatar_name: "Gravatar", + gravatar_base_url: "www.gravatar.com", + gravatar_login_url: "/emails", + enable_group_directory: true, + enable_category_group_moderation: false, + min_post_length: 20, + min_first_post_length: 20, + min_personal_message_post_length: 10, + max_post_length: 32000, + topic_featured_link_enabled: true, + min_topic_views_for_delete_confirm: 5000, + min_topic_title_length: 15, + max_topic_title_length: 255, + enable_filtered_replies_view: false, + min_personal_message_title_length: 2, + allow_uncategorized_topics: true, + min_title_similar_length: 10, + enable_personal_messages: true, + edit_history_visible_to_public: true, + delete_removed_posts_after: 24, + traditional_markdown_linebreaks: false, + enable_markdown_typographer: true, + enable_markdown_linkify: true, + markdown_linkify_tlds: + "com|net|org|io|onion|co|tv|ru|cn|us|uk|me|de|fr|fi|gov", + markdown_typographer_quotation_marks: "“|”|‘|’", + enable_rich_text_paste: true, + suppress_reply_directly_below: true, + suppress_reply_directly_above: true, + max_reply_history: 1, + enable_mentions: true, + here_mention: "here", + newuser_max_embedded_media: 1, + newuser_max_attachments: 0, + show_pinned_excerpt_mobile: true, + show_pinned_excerpt_desktop: true, + display_name_on_posts: false, + show_time_gap_days: 7, + short_progress_text_threshold: 10000, + default_code_lang: "auto", + autohighlight_all_code: false, + highlighted_languages: + "apache|bash|cs|cpp|css|coffeescript|diff|xml|http|ini|json|java|javascript|makefile|markdown|nginx|objectivec|ruby|perl|php|python|sql|handlebars", + show_copy_button_on_codeblocks: false, + enable_emoji: true, + enable_emoji_shortcuts: true, + emoji_set: "twitter", + emoji_autocomplete_min_chars: 0, + enable_inline_emoji_translation: false, + code_formatting_style: "code-fences", + allowed_href_schemes: "", + watched_words_regular_expressions: false, + enable_diffhtml_preview: false, + enable_fast_edit: true, + old_post_notice_days: 14, + blur_tl0_flagged_posts_media: true, + email_time_window_mins: 10, + disable_digest_emails: false, + email_in: false, + enable_imap: false, + enable_smtp: false, + disable_emails: "no", + bounce_score_threshold: 4, + enable_secondary_emails: true, + max_image_size_kb: 4096, + max_attachment_size_kb: 4096, + authorized_extensions: "jpg|jpeg|png|gif|heic|heif|webp", + authorized_extensions_for_staff: "", + max_image_width: 690, + max_image_height: 500, + prevent_anons_from_downloading_files: false, + secure_media: false, + enable_s3_uploads: false, + allow_profile_backgrounds: true, + allow_uploaded_avatars: "0", + default_avatars: "", + external_system_avatars_enabled: true, + external_system_avatars_url: + "/letter_avatar_proxy/v4/letter/{first_letter}/{color}/{size}.png", + external_emoji_url: "", + selectable_avatars_mode: "disabled", + selectable_avatars: "", + allow_staff_to_upload_any_file_in_pm: true, + simultaneous_uploads: 5, + composer_media_optimization_image_enabled: true, + composer_media_optimization_image_bytes_optimization_threshold: 524288, + composer_media_optimization_image_resize_dimensions_threshold: 1920, + composer_media_optimization_image_resize_width_target: 1920, + composer_media_optimization_image_resize_pre_multiply: false, + composer_media_optimization_image_resize_linear_rgb: false, + composer_media_optimization_image_encode_quality: 75, + composer_media_optimization_debug_mode: false, + min_trust_level_to_allow_profile_background: 0, + min_trust_level_to_allow_user_card_background: 0, + min_trust_level_to_allow_ignore: 2, + tl1_requires_read_posts: 30, + tl3_links_no_follow: false, + enforce_second_factor: "no", + moderators_change_post_ownership: false, + moderators_view_emails: false, + use_admin_ip_allowlist: false, + allowed_iframes: + "https://www.google.com/maps/embed?|https://www.openstreetmap.org/export/embed.html?|https://calendar.google.com/calendar/embed?|https://codepen.io/|https://www.instagram.com|http://localhost:3000/discobot/certificate.svg", + can_permanently_delete: false, + max_oneboxes_per_post: 50, + reviewable_claiming: "disabled", + reviewable_default_topics: false, + reviewable_default_visibility: "low", + alert_admins_if_errors_per_minute: 0, + alert_admins_if_errors_per_hour: 0, + max_prints_per_hour_per_user: 5, + invite_link_max_redemptions_limit: 5000, + invite_link_max_redemptions_limit_users: 10, + enable_long_polling: true, + enable_chunked_encoding: true, + long_polling_base_url: "/", + background_polling_interval: 60000, + polling_interval: 3000, + anon_polling_interval: 25000, + flush_timings_secs: 60, + verbose_localization: false, + max_new_topics: 500, + enable_safe_mode: true, + tos_url: "", + privacy_policy_url: "", + faq_url: "", + enable_backups: true, + backup_location: "local", + maximum_backups: 5, + use_pg_headlines_for_excerpt: false, + min_search_term_length: 3, + log_search_queries: true, + version_checks: true, + suppress_uncategorized_badge: true, + header_dropdown_category_count: 8, + slug_generation_method: "ascii", + summary_timeline_button: false, + topic_views_heat_low: 1000, + topic_views_heat_medium: 2000, + topic_views_heat_high: 3500, + topic_post_like_heat_low: 0.5, + topic_post_like_heat_medium: 1, + topic_post_like_heat_high: 2, + history_hours_low: 12, + history_hours_medium: 24, + history_hours_high: 48, + cold_age_days_low: 14, + cold_age_days_medium: 90, + cold_age_days_high: 180, + global_notice: "", + show_create_topics_notice: true, + bootstrap_mode_min_users: 50, + bootstrap_mode_enabled: true, + automatically_unpin_topics: true, + read_time_word_count: 500, + topic_page_title_includes_category: true, + svg_icon_subset: "", + allow_bulk_invite: true, + disable_mailing_list_mode: true, + default_topics_automatic_unpin: true, + mute_all_categories_by_default: false, + tagging_enabled: true, + tag_style: "simple", + max_tags_per_topic: 5, + max_tag_length: 20, + min_trust_level_to_tag_topics: "0", + max_tag_search_results: 5, + max_tags_in_filter_list: 30, + tags_sort_alphabetically: false, + tags_listed_by_group: false, + suppress_overlapping_tags_in_list: false, + remove_muted_tags_from_latest: "always", + force_lowercase_tags: true, + dashboard_hidden_reports: "", + dashboard_visible_tabs: "moderation|security|reports", + dashboard_general_tab_activity_metrics: + "page_view_total_reqs|visits|time_to_first_response|likes|flags|user_to_user_private_messages_with_replies", + discourse_narrative_bot_enabled: true, + details_enabled: true, + custom_wizard_enabled: true, + wizard_redirect_exclude_paths: "admin", + wizard_recognised_image_upload_formats: "jpg|jpeg|png|gif", + wizard_important_notices_on_dashboard: true, + discourse_local_dates_email_format: "YYYY-MM-DDTHH:mm:ss[Z]", + discourse_local_dates_enabled: true, + discourse_local_dates_default_formats: "LLL|LTS|LL|LLLL", + discourse_local_dates_default_timezones: "Europe/Paris|America/Los_Angeles", + poll_enabled: true, + poll_maximum_options: 20, + poll_minimum_trust_level_to_create: 1, + poll_groupable_user_fields: "", + poll_export_data_explorer_query_id: -16, + presence_enabled: true, + presence_max_users_shown: 5, + available_locales: + '[{"name":"اللغة العربية","value":"ar"},{"name":"беларуская мова","value":"be"},{"name":"български език","value":"bg"},{"name":"bosanski jezik","value":"bs_BA"},{"name":"català","value":"ca"},{"name":"čeština","value":"cs"},{"name":"dansk","value":"da"},{"name":"Deutsch","value":"de"},{"name":"ελληνικά","value":"el"},{"name":"English (US)","value":"en"},{"name":"English (UK)","value":"en_GB"},{"name":"Español","value":"es"},{"name":"eesti","value":"et"},{"name":"فارسی","value":"fa_IR"},{"name":"suomi","value":"fi"},{"name":"Français","value":"fr"},{"name":"galego","value":"gl"},{"name":"עברית","value":"he"},{"name":"magyar","value":"hu"},{"name":"Հայերեն","value":"hy"},{"name":"Indonesian","value":"id"},{"name":"Italiano","value":"it"},{"name":"日本語","value":"ja"},{"name":"한국어","value":"ko"},{"name":"lietuvių kalba","value":"lt"},{"name":"latviešu valoda","value":"lv"},{"name":"Norsk bokmål","value":"nb_NO"},{"name":"Nederlands","value":"nl"},{"name":"polski","value":"pl_PL"},{"name":"Português","value":"pt"},{"name":"Português (BR)","value":"pt_BR"},{"name":"limba română","value":"ro"},{"name":"Русский","value":"ru"},{"name":"slovenčina","value":"sk"},{"name":"slovenščina","value":"sl"},{"name":"Shqip","value":"sq"},{"name":"српски језик","value":"sr"},{"name":"svenska","value":"sv"},{"name":"Kiswahili","value":"sw"},{"name":"తెలుగు","value":"te"},{"name":"ไทย","value":"th"},{"name":"Türkçe","value":"tr_TR"},{"name":"українська мова","value":"uk"},{"name":"اردو","value":"ur"},{"name":"Việt Nam","value":"vi"},{"name":"简体中文","value":"zh_CN"},{"name":"繁體中文","value":"zh_TW"}]', + require_invite_code: false, + site_logo_url: "http://localhost:3000/images/discourse-logo-sketch.png", + site_logo_small_url: + "http://localhost:3000/images/discourse-logo-sketch-small.png", + site_mobile_logo_url: + "http://localhost:3000/images/discourse-logo-sketch.png", + site_favicon_url: + "http://localhost:3000/uploads/default/optimized/1X/_129430568242d1b7f853bb13ebea28b3f6af4e7_2_32x32.png", + site_logo_dark_url: "", + site_logo_small_dark_url: "", + site_mobile_logo_dark_url: "", +}; diff --git a/assets/javascripts/wizard/tests/fixtures/tags.js.es6 b/assets/javascripts/wizard/tests/fixtures/tags.js.es6 index a072772e..61e51994 100644 --- a/assets/javascripts/wizard/tests/fixtures/tags.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/tags.js.es6 @@ -1,22 +1,22 @@ export default { - "tags": [ + tags: [ { - "id": "tag1", - "text": "tag1", - "name": "tag1", - "description": null, - "count": 1, - "pm_count": 0, - "target_tag": null + id: "tag1", + text: "tag1", + name: "tag1", + description: null, + count: 1, + pm_count: 0, + target_tag: null, }, { - "id": "tag2", - "text": "tag2", - "name": "tag2", - "description": null, - "count": 1, - "pm_count": 0, - "target_tag": null - } - ] -} + id: "tag2", + text: "tag2", + name: "tag2", + description: null, + count: 1, + pm_count: 0, + target_tag: null, + }, + ], +}; diff --git a/assets/javascripts/wizard/tests/fixtures/update.js.es6 b/assets/javascripts/wizard/tests/fixtures/update.js.es6 index 3908525c..5b20788c 100644 --- a/assets/javascripts/wizard/tests/fixtures/update.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/update.js.es6 @@ -1,5 +1,5 @@ export default { - "final": false, - "next_step_id": "step_2", - "wizard": {} -} + final: false, + next_step_id: "step_2", + wizard: {}, +}; diff --git a/assets/javascripts/wizard/tests/fixtures/user.js.es6 b/assets/javascripts/wizard/tests/fixtures/user.js.es6 index 8acd7392..d954905c 100644 --- a/assets/javascripts/wizard/tests/fixtures/user.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/user.js.es6 @@ -30,5 +30,5 @@ export default { title_count_mode: "notifications", timezone: "Australia/Perth", skip_new_user_tips: false, - can_review: true -} + can_review: true, +}; diff --git a/assets/javascripts/wizard/tests/fixtures/users.js.es6 b/assets/javascripts/wizard/tests/fixtures/users.js.es6 index 267d4909..437631a2 100644 --- a/assets/javascripts/wizard/tests/fixtures/users.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/users.js.es6 @@ -1,14 +1,14 @@ export default { - "users": [ + users: [ { - "username": "angus", - "name": "Angus", - "avatar_template": "/user_avatar/localhost/angus/{size}/12_2.png" + username: "angus", + name: "Angus", + avatar_template: "/user_avatar/localhost/angus/{size}/12_2.png", }, { - "username": "angus_2", - "name": "Angus 2", - "avatar_template": "/letter_avatar_proxy/v4/letter/a/e9a140/{size}.png" - } - ] -} + username: "angus_2", + name: "Angus 2", + avatar_template: "/letter_avatar_proxy/v4/letter/a/e9a140/{size}.png", + }, + ], +}; diff --git a/assets/javascripts/wizard/tests/fixtures/wizard.js.es6 b/assets/javascripts/wizard/tests/fixtures/wizard.js.es6 index be4fa8b2..73fe45c1 100644 --- a/assets/javascripts/wizard/tests/fixtures/wizard.js.es6 +++ b/assets/javascripts/wizard/tests/fixtures/wizard.js.es6 @@ -1,469 +1,471 @@ export default { - "id": "wizard", - "name": "Wizard", - "start": "step_1", - "background": "#333333", - "submission_last_updated_at": "2022-03-15T21:11:01+01:00", - "theme_id": 2, - "required": false, - "permitted": true, - "uncategorized_category_id": 1, - "categories": [], - "subscribed": false, - "resume_on_revisit": false, - "steps": [ + id: "wizard", + name: "Wizard", + start: "step_1", + background: "#333333", + submission_last_updated_at: "2022-03-15T21:11:01+01:00", + theme_id: 2, + required: false, + permitted: true, + uncategorized_category_id: 1, + categories: [], + subscribed: false, + resume_on_revisit: false, + steps: [ { - "id": "step_1", - "index": 0, - "next": "step_2", - "description": "

Text inputs!

", - "title": "Text", - "permitted": true, - "permitted_message": null, - "final": false, - "fields": [ + id: "step_1", + index: 0, + next: "step_2", + description: "

Text inputs!

", + title: "Text", + permitted: true, + permitted_message: null, + final: false, + fields: [ { - "id": "step_1_field_1", - "index": 0, - "type": "text", - "required": false, - "value": "I am prefilled", - "label": "

Text

", - "description": "Text field description.", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 1, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_1", - "_validState": 0 + id: "step_1_field_1", + index: 0, + type: "text", + required: false, + value: "I am prefilled", + label: "

Text

", + description: "Text field description.", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 1, + wizardId: "super_mega_fun_wizard", + stepId: "step_1", + _validState: 0, }, { - "id": "step_1_field_2", - "index": 0, - "type": "textarea", - "required": false, - "value": "", - "label": "

Textarea

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 2, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_1", - "_validState": 0 + id: "step_1_field_2", + index: 0, + type: "textarea", + required: false, + value: "", + label: "

Textarea

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 2, + wizardId: "super_mega_fun_wizard", + stepId: "step_1", + _validState: 0, }, { - "id": "step_1_field_3", - "index": 2, - "type": "composer", - "required": false, - "value": "", - "label": "

Composer

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 3, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_1", - "_validState": 0 + id: "step_1_field_3", + index: 2, + type: "composer", + required: false, + value: "", + label: "

Composer

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 3, + wizardId: "super_mega_fun_wizard", + stepId: "step_1", + _validState: 0, }, { - "id": "step_1_field_4", - "index": 3, - "type": "text_only", - "required": false, - "value": null, - "label": "

I’m only text

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 4, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_1", - "_validState": 0 + id: "step_1_field_4", + index: 3, + type: "text_only", + required: false, + value: null, + label: "

I’m only text

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 4, + wizardId: "super_mega_fun_wizard", + stepId: "step_1", + _validState: 0, }, { - "id": "step_1_field_5", - "index": 4, - "type": "composer_preview", - "required": false, - "value": "", - "label": "

I’m a preview

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": "

I am prefilled

", - "tabindex": 5, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_1", - "_validState": 0 + id: "step_1_field_5", + index: 4, + type: "composer_preview", + required: false, + value: "", + label: "

I’m a preview

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: "

I am prefilled

", + tabindex: 5, + wizardId: "super_mega_fun_wizard", + stepId: "step_1", + _validState: 0, }, { - "id": "step_1_field_6", - "index": 5, - "type": "composer_preview", - "required": false, - "value": "", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": "

This is the preview of the composer

", - "tabindex": 6, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_1", - "_validState": 0 - } + id: "step_1_field_6", + index: 5, + type: "composer_preview", + required: false, + value: "", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: "

This is the preview of the composer

", + tabindex: 6, + wizardId: "super_mega_fun_wizard", + stepId: "step_1", + _validState: 0, + }, ], - "_validState": 0, - "wizardId": "super_mega_fun_wizard" + _validState: 0, + wizardId: "super_mega_fun_wizard", }, { - "id": "step_2", - "index": 1, - "next": "step_3", - "previous": "step_1", - "description": "

Because I couldn’t think of another name for this step \":slight_smile:\"

", - "title": "Values", - "permitted": true, - "permitted_message": null, - "final": false, - "fields": [ + id: "step_2", + index: 1, + next: "step_3", + previous: "step_1", + description: + '

Because I couldn’t think of another name for this step :slight_smile:

', + title: "Values", + permitted: true, + permitted_message: null, + final: false, + fields: [ { - "id": "step_2_field_1", - "index": 0, - "type": "date", - "required": false, - "value": "", - "label": "

Date

", - "file_types": null, - "format": "YYYY-MM-DD", - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 1, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 + id: "step_2_field_1", + index: 0, + type: "date", + required: false, + value: "", + label: "

Date

", + file_types: null, + format: "YYYY-MM-DD", + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 1, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, }, { - "id": "step_2_field_2", - "index": 0, - "type": "time", - "required": false, - "value": "", - "label": "

Time

", - "file_types": null, - "format": "HH:mm", - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 2, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 + id: "step_2_field_2", + index: 0, + type: "time", + required: false, + value: "", + label: "

Time

", + file_types: null, + format: "HH:mm", + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 2, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, }, { - "id": "step_2_field_3", - "index": 2, - "type": "date_time", - "required": false, - "value": "", - "label": "

Date & Time

", - "file_types": null, - "format": "", - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 3, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 + id: "step_2_field_3", + index: 2, + type: "date_time", + required: false, + value: "", + label: "

Date & Time

", + file_types: null, + format: "", + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 3, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, }, { - "id": "step_2_field_4", - "index": 3, - "type": "number", - "required": false, - "value": "", - "label": "

Number

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 5, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 + id: "step_2_field_4", + index: 3, + type: "number", + required: false, + value: "", + label: "

Number

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 5, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, }, { - "id": "step_2_field_5", - "index": 4, - "type": "checkbox", - "required": false, - "value": false, - "label": "

Checkbox

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 6, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 + id: "step_2_field_5", + index: 4, + type: "checkbox", + required: false, + value: false, + label: "

Checkbox

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 6, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, }, { - "id": "step_2_field_6", - "index": 5, - "type": "url", - "required": false, - "value": "", - "label": "

Url

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 7, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 + id: "step_2_field_6", + index: 5, + type: "url", + required: false, + value: "", + label: "

Url

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 7, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, }, { - "id": "step_2_field_7", - "index": 6, - "type": "upload", - "required": false, - "value": "", - "label": "

Upload

", - "file_types": ".jpg,.jpeg,.png", - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 8, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_2", - "_validState": 0 - } + id: "step_2_field_7", + index: 6, + type: "upload", + required: false, + value: "", + label: "

Upload

", + file_types: ".jpg,.jpeg,.png", + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 8, + wizardId: "super_mega_fun_wizard", + stepId: "step_2", + _validState: 0, + }, ], - "_validState": 0, - "wizardId": "super_mega_fun_wizard" + _validState: 0, + wizardId: "super_mega_fun_wizard", }, { - "id": "step_3", - "index": 2, - "previous": "step_2", - "description": "

Unfortunately not the edible type \":sushi:\"

", - "title": "Combo-boxes", - "permitted": true, - "permitted_message": null, - "final": true, - "fields": [ + id: "step_3", + index: 2, + previous: "step_2", + description: + '

Unfortunately not the edible type :sushi:

', + title: "Combo-boxes", + permitted: true, + permitted_message: null, + final: true, + fields: [ { - "id": "step_3_field_1", - "index": 0, - "type": "dropdown", - "required": false, - "value": "choice1", - "label": "

Custom Dropdown

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": [ + id: "step_3_field_1", + index: 0, + type: "dropdown", + required: false, + value: "choice1", + label: "

Custom Dropdown

", + file_types: null, + format: null, + limit: null, + property: null, + content: [ { - "id": "one", - "name": "One" + id: "one", + name: "One", }, { - "id": "two", - "name": "Two" - } + id: "two", + name: "Two", + }, ], - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 1, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_3", - "_validState": 0 + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 1, + wizardId: "super_mega_fun_wizard", + stepId: "step_3", + _validState: 0, }, { - "id": "step_3_field_2", - "index": 0, - "type": "tag", - "required": false, - "value": null, - "label": "

Tag

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 2, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_3", - "_validState": 0 + id: "step_3_field_2", + index: 0, + type: "tag", + required: false, + value: null, + label: "

Tag

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 2, + wizardId: "super_mega_fun_wizard", + stepId: "step_3", + _validState: 0, }, { - "id": "step_3_field_3", - "index": 2, - "type": "category", - "required": false, - "value": null, - "label": "

Category

", - "file_types": null, - "format": null, - "limit": 1, - "property": "id", - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 3, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_3", - "_validState": 0 + id: "step_3_field_3", + index: 2, + type: "category", + required: false, + value: null, + label: "

Category

", + file_types: null, + format: null, + limit: 1, + property: "id", + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 3, + wizardId: "super_mega_fun_wizard", + stepId: "step_3", + _validState: 0, }, { - "id": "step_3_field_4", - "index": 3, - "type": "group", - "required": false, - "value": null, - "label": "

Group

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 4, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_3", - "_validState": 0 + id: "step_3_field_4", + index: 3, + type: "group", + required: false, + value: null, + label: "

Group

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 4, + wizardId: "super_mega_fun_wizard", + stepId: "step_3", + _validState: 0, }, { - "id": "step_3_field_5", - "index": 4, - "type": "user_selector", - "required": false, - "value": null, - "label": "

User Selector

", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 5, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_3", - "_validState": 0 + id: "step_3_field_5", + index: 4, + type: "user_selector", + required: false, + value: null, + label: "

User Selector

", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 5, + wizardId: "super_mega_fun_wizard", + stepId: "step_3", + _validState: 0, }, { - "id": "step_3_field_6", - "index": 5, - "type": "user_selector", - "required": false, - "value": null, - "label": "

Conditional User Selector

", - "description": "Shown when checkbox in step_2_field_5 is true", - "file_types": null, - "format": null, - "limit": null, - "property": null, - "content": null, - "validations": {}, - "max_length": null, - "char_counter": null, - "preview_template": null, - "tabindex": 6, - "wizardId": "super_mega_fun_wizard", - "stepId": "step_3", - "_validState": 0 - } + id: "step_3_field_6", + index: 5, + type: "user_selector", + required: false, + value: null, + label: "

Conditional User Selector

", + description: "Shown when checkbox in step_2_field_5 is true", + file_types: null, + format: null, + limit: null, + property: null, + content: null, + validations: {}, + max_length: null, + char_counter: null, + preview_template: null, + tabindex: 6, + wizardId: "super_mega_fun_wizard", + stepId: "step_3", + _validState: 0, + }, ], - "_validState": 0, - "wizardId": "super_mega_fun_wizard" - } + _validState: 0, + wizardId: "super_mega_fun_wizard", + }, ], - "groups": [] -} + groups: [], +}; diff --git a/assets/javascripts/wizard/tests/helpers/acceptance.js.es6 b/assets/javascripts/wizard/tests/helpers/acceptance.js.es6 index f5c1175f..913e8c7a 100644 --- a/assets/javascripts/wizard/tests/helpers/acceptance.js.es6 +++ b/assets/javascripts/wizard/tests/helpers/acceptance.js.es6 @@ -6,18 +6,20 @@ let server; let app; function acceptance(name, requests, cb) { - module(`Acceptance: ${name}`, function(hooks) { - hooks.beforeEach(function() { - server = setupPretender(function(pretender) { - requests.forEach(req => { - pretender[req.verb](req.path, () => (response(req.status, req.response))); + module(`Acceptance: ${name}`, function (hooks) { + hooks.beforeEach(function () { + server = setupPretender(function (pretender) { + requests.forEach((req) => { + pretender[req.verb](req.path, () => + response(req.status, req.response) + ); }); return pretender; }); app = startApp(); }); - hooks.afterEach(function() { + hooks.afterEach(function () { app.destroy(); server.shutdown(); }); @@ -28,9 +30,7 @@ function acceptance(name, requests, cb) { export default acceptance; -export { - server -}; +export { server }; // The discourse/test/helpers/qunit-helpers file has many functions and imports // we don't need, so there will be some duplciation here. diff --git a/assets/javascripts/wizard/tests/helpers/start-app.js.es6 b/assets/javascripts/wizard/tests/helpers/start-app.js.es6 index 6afe6eb9..821d8033 100644 --- a/assets/javascripts/wizard/tests/helpers/start-app.js.es6 +++ b/assets/javascripts/wizard/tests/helpers/start-app.js.es6 @@ -1,6 +1,12 @@ -const CustomWizard = requirejs("discourse/plugins/discourse-custom-wizard/wizard/application").default; -const initializer = requirejs("discourse/plugins/discourse-custom-wizard/wizard/lib/initialize/wizard").default; -const siteSettings = requirejs("discourse/plugins/discourse-custom-wizard/wizard/tests/fixtures/site-settings").default; +const CustomWizard = requirejs( + "discourse/plugins/discourse-custom-wizard/wizard/application" +).default; +const initializer = requirejs( + "discourse/plugins/discourse-custom-wizard/wizard/lib/initialize/wizard" +).default; +const siteSettings = requirejs( + "discourse/plugins/discourse-custom-wizard/wizard/tests/fixtures/site-settings" +).default; const { cloneJSON } = requirejs("discourse-common/lib/object").default; let app; diff --git a/assets/javascripts/wizard/tests/helpers/step.js.es6 b/assets/javascripts/wizard/tests/helpers/step.js.es6 index a24e04e1..41fe16cd 100644 --- a/assets/javascripts/wizard/tests/helpers/step.js.es6 +++ b/assets/javascripts/wizard/tests/helpers/step.js.es6 @@ -5,16 +5,13 @@ import wizardJson from "../fixtures/wizard"; const update = cloneJSON(updateJson); update.wizard = cloneJSON(wizardJson); -const saveStep = function(response) { +const saveStep = function (response) { return { verb: "put", - path: '/w/wizard/steps/:step_id', + path: "/w/wizard/steps/:step_id", status: 200, - response - } -} + response, + }; +}; -export { - saveStep, - update -} +export { saveStep, update }; diff --git a/assets/javascripts/wizard/tests/helpers/test.js.es6 b/assets/javascripts/wizard/tests/helpers/test.js.es6 index c7401fd5..360c883a 100644 --- a/assets/javascripts/wizard/tests/helpers/test.js.es6 +++ b/assets/javascripts/wizard/tests/helpers/test.js.es6 @@ -2,6 +2,4 @@ function exists(selector) { return document.querySelector(selector) !== null; } -export { - exists -} +export { exists }; diff --git a/assets/javascripts/wizard/tests/helpers/wizard.js.es6 b/assets/javascripts/wizard/tests/helpers/wizard.js.es6 index 997f6c36..4cd2e003 100644 --- a/assets/javascripts/wizard/tests/helpers/wizard.js.es6 +++ b/assets/javascripts/wizard/tests/helpers/wizard.js.es6 @@ -26,20 +26,20 @@ const allFieldsWizard = cloneJSON(wizard); allFieldsWizard.steps[0].fields = [ ...allFieldsWizard.steps[0].fields, ...allFieldsWizard.steps[1].fields, - ...allFieldsWizard.steps[2].fields + ...allFieldsWizard.steps[2].fields, ]; allFieldsWizard.steps = [cloneJSON(allFieldsWizard.steps[0])]; -allFieldsWizard.categories = cloneJSON(categoriesJson['categories']); -allFieldsWizard.groups = cloneJSON(groupsJson['groups']); +allFieldsWizard.categories = cloneJSON(categoriesJson["categories"]); +allFieldsWizard.groups = cloneJSON(groupsJson["groups"]); -const getWizard = function(response) { +const getWizard = function (response) { return { verb: "get", path: "/w/wizard", status: 200, - response - } -} + response, + }; +}; export { getWizard, @@ -48,5 +48,5 @@ export { wizardCompleted, stepNotPermitted, allFieldsWizard, - wizard -} + wizard, +}; diff --git a/assets/javascripts/wizard/tests/pretender.js.es6 b/assets/javascripts/wizard/tests/pretender.js.es6 index 88eae666..1f1d4a7d 100644 --- a/assets/javascripts/wizard/tests/pretender.js.es6 +++ b/assets/javascripts/wizard/tests/pretender.js.es6 @@ -1,23 +1,5 @@ import Pretender from "pretender"; -function parsePostData(query) { - const result = {}; - query.split("&").forEach(function (part) { - const item = part.split("="); - const firstSeg = decodeURIComponent(item[0]); - const m = /^([^\[]+)\[([^\]]+)\]/.exec(firstSeg); - - const val = decodeURIComponent(item[1]).replace(/\+/g, " "); - if (m) { - result[m[1]] = result[m[1]] || {}; - result[m[1]][m[2]] = val; - } else { - result[firstSeg] = val; - } - }); - return result; -} - function response(code, obj) { if (typeof code === "object") { obj = code; @@ -42,7 +24,7 @@ export default function (cb) { return body; }; - server.unhandledRequest = function (verb, path, request) { + server.unhandledRequest = function (verb, path) { const error = "Unhandled request in test environment: " + path + " (" + verb + ")"; window.console.error(error);