DEV: Add acceptance tests

This commit is contained in:
Keegan George 2022-07-04 18:03:43 -07:00
parent ccaa7b1d41
commit 34d1327951
3 changed files with 34 additions and 2 deletions

View File

@ -8,4 +8,4 @@ A theme component that adds a button to the composer tools to easily build table
- [X] Add table builder functionality
- [ ] Possibly add the ability to edit tables
- [ ] Add front-end tests
- [X] Add front-end tests

View File

@ -26,7 +26,7 @@
<div class="modal-footer">
<DButton
@class="btn-primary"
@class="btn-primary btn-build-table"
@label={{theme-prefix "discourse_table_builder.modal.create"}}
@icon="plus"
@action={{action "createTable"}}

View File

@ -0,0 +1,32 @@
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
acceptance("Table Builder", function (needs) {
needs.user();
test("Can open table builder when creating a topic", async function (assert) {
await visit("/");
await click("#create-topic");
click(".table-builder");
assert.ok(exists(".table-builder-modal"));
});
test("Can build table", async function (assert) {
await visit("/");
await click("#create-topic");
click(".btn-build-table");
assert.ok(exists(".d-editor-preview .md-table"));
});
test("Can build table when editing post", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#post_1 .show-more-actions");
await click("#post_1 .edit");
assert.ok(exists("#reply-control"));
click(".table-builder");
assert.ok(exists(".table-builder-modal"));
click(".btn-build-table");
assert.ok(exists(".d-editor-preview .md-table"));
});
});