mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 03:32:17 +08: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(
|
||||
|
Reference in New Issue
Block a user