This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js
Robin Ward 6f25f17360
DEV: Revisit skipped tests (#15769)
* Some are no longer flaky or easily fixed

* Some are out of date or test things we can't do accurately (scroll
  position) and are removed.

* Unwinds some uppy tests and makes sure all promises and runloops are
  resolved.

Everything has been run in legacy/ember cli multiple times to ensure no
obvious suite regressions.
2022-02-02 12:09:03 -05:00

49 lines
1.3 KiB
JavaScript

import componentTest, {
setupRenderingTest,
} from "discourse/tests/helpers/component-test";
import {
discourseModule,
exists,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import hbs from "htmlbars-inline-precompile";
discourseModule("Integration | Component | ace-editor", function (hooks) {
setupRenderingTest(hooks);
componentTest("css editor", {
template: hbs`{{ace-editor mode="css"}}`,
test(assert) {
assert.ok(exists(".ace_editor"), "it renders the ace editor");
},
});
componentTest("html editor", {
template: hbs`{{ace-editor mode="html" content="<b>wat</b>"}}`,
test(assert) {
assert.ok(exists(".ace_editor"), "it renders the ace editor");
},
});
componentTest("sql editor", {
template: hbs`{{ace-editor mode="sql" content="SELECT * FROM users"}}`,
test(assert) {
assert.ok(exists(".ace_editor"), "it renders the ace editor");
},
});
componentTest("disabled editor", {
template: hbs`
{{ace-editor mode="sql" content="SELECT * FROM users" disabled=true}}
`,
test(assert) {
assert.ok(exists(".ace_editor"), "it renders the ace editor");
assert.equal(
queryAll(".ace-wrapper[data-disabled]").length,
1,
"it has a data-disabled attr"
);
},
});
});