mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
select-kit refactoring
* better test helper * more reliable tests * more consistent use of data-value/data-name/title/aria-label everywhere: header and rows
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||
|
||||
acceptance('Details Button', { loggedIn: true });
|
||||
acceptance('Details Button', {
|
||||
loggedIn: true,
|
||||
beforeEach: function() {
|
||||
clearPopupMenuOptionsCallback();
|
||||
}
|
||||
});
|
||||
|
||||
function findTextarea() {
|
||||
return find(".d-editor-input")[0];
|
||||
}
|
||||
|
||||
test('details button', (assert) => {
|
||||
const popupMenu = selectKit('.toolbar-popup-menu-options');
|
||||
|
||||
visit("/");
|
||||
click('#create-topic');
|
||||
expandSelectKit('.toolbar-popup-menu-options');
|
||||
selectKitSelectRow('insertDetails', { selector: '.toolbar-popup-menu-options'});
|
||||
|
||||
popupMenu.expand().selectRowByValue('insertDetails');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
@@ -28,8 +36,7 @@ test('details button', (assert) => {
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
});
|
||||
|
||||
expandSelectKit('.toolbar-popup-menu-options');
|
||||
selectKitSelectRow('insertDetails', { selector: '.toolbar-popup-menu-options'});
|
||||
popupMenu.expand().selectRowByValue('insertDetails');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
@@ -51,8 +58,7 @@ test('details button', (assert) => {
|
||||
textarea.selectionEnd = 28;
|
||||
});
|
||||
|
||||
expandSelectKit('.toolbar-popup-menu-options');
|
||||
selectKitSelectRow('insertDetails', { selector: '.toolbar-popup-menu-options'});
|
||||
popupMenu.expand().selectRowByValue('insertDetails');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
@@ -74,8 +80,7 @@ test('details button', (assert) => {
|
||||
textarea.selectionEnd = 29;
|
||||
});
|
||||
|
||||
expandSelectKit('.toolbar-popup-menu-options');
|
||||
selectKitSelectRow('insertDetails', { selector: '.toolbar-popup-menu-options'});
|
||||
popupMenu.expand().selectRowByValue('insertDetails');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
@@ -92,6 +97,7 @@ test('details button', (assert) => {
|
||||
|
||||
test('details button surrounds all selected text in a single details block', (assert) => {
|
||||
const multilineInput = 'first line\n\nsecond line\n\nthird line';
|
||||
const popupMenu = selectKit('.toolbar-popup-menu-options');
|
||||
|
||||
visit("/");
|
||||
click('#create-topic');
|
||||
@@ -103,8 +109,7 @@ test('details button surrounds all selected text in a single details block', (as
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
});
|
||||
|
||||
expandSelectKit('.toolbar-popup-menu-options');
|
||||
selectKitSelectRow('insertDetails', { selector: '.toolbar-popup-menu-options'});
|
||||
popupMenu.expand().selectRowByValue('insertDetails');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
|
||||
import { replaceCurrentUser } from "discourse/plugins/poll/helpers/replace-current-user";
|
||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||
|
||||
acceptance("Poll Builder - polls are disabled", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
poll_enabled: false,
|
||||
poll_minimum_trust_level_to_create: 2
|
||||
},
|
||||
beforeEach: function() {
|
||||
clearPopupMenuOptionsCallback();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { displayPollBuilderButton } from "discourse/plugins/poll/helpers/display-poll-builder-button";
|
||||
import { replaceCurrentUser } from "discourse/plugins/poll/helpers/replace-current-user";
|
||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||
|
||||
acceptance("Poll Builder - polls are enabled", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
poll_enabled: true,
|
||||
poll_minimum_trust_level_to_create: 1
|
||||
},
|
||||
beforeEach: function() {
|
||||
clearPopupMenuOptionsCallback();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
|
||||
|
||||
acceptance("Rendering polls", {
|
||||
loggedIn: true,
|
||||
settings: { poll_enabled: true }
|
||||
settings: { poll_enabled: true },
|
||||
beforeEach: function() {
|
||||
clearPopupMenuOptionsCallback();
|
||||
}
|
||||
});
|
||||
|
||||
test("Single Poll", (assert) => {
|
||||
|
||||
@@ -2,6 +2,5 @@ export function displayPollBuilderButton() {
|
||||
visit("/");
|
||||
click("#create-topic");
|
||||
click(".d-editor-button-bar .options");
|
||||
|
||||
expandSelectKit('.toolbar-popup-menu-options');
|
||||
selectKit(".toolbar-popup-menu-options").expand();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user