DEV: global s/this.get\("(\w+)"\)/this.$1 (#7592)

This commit is contained in:
Joffrey JAFFEUX
2019-05-27 10:15:39 +02:00
committed by GitHub
parent 170c66c190
commit bfea922167
389 changed files with 2448 additions and 2460 deletions

View File

@ -12,13 +12,13 @@ componentTest("with value", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
2
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"feature"
@ -30,10 +30,10 @@ componentTest("with excludeCategoryId", {
template: "{{category-chooser excludeCategoryId=2}}",
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.notOk(
this.get("subject")
this.subject
.rowByValue(2)
.exists()
);
@ -44,37 +44,37 @@ componentTest("with scopedCategoryId", {
template: "{{category-chooser scopedCategoryId=2}}",
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.title(),
"Discussion about features or potential features of Discourse: how they work, why they work, etc."
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.value(),
2
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.title(),
"My idea here is to have mini specs for features we would like built but have no bandwidth to build"
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.value(),
26
);
assert.equal(this.get("subject").rows().length, 2);
assert.equal(this.subject.rows().length, 2);
await this.get("subject").fillInFilter("dev");
await this.subject.fillInFilter("dev");
assert.equal(this.get("subject").rows().length, 3);
assert.equal(this.subject.rows().length, 3);
}
});
@ -87,13 +87,13 @@ componentTest("with allowUncategorized=null", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"category"
@ -110,13 +110,13 @@ componentTest("with allowUncategorized=null rootNone=true", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"category"
@ -135,13 +135,13 @@ componentTest("with disallowed uncategorized, rootNone and rootNoneLabel", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"category"
@ -158,13 +158,13 @@ componentTest("with allowed uncategorized", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"uncategorized"
@ -181,13 +181,13 @@ componentTest("with allowed uncategorized and rootNone", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"(no category)"
@ -206,13 +206,13 @@ componentTest("with allowed uncategorized rootNone and rootNoneLabel", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"root none label"

View File

@ -25,23 +25,23 @@ componentTest("subcatgories - no selection", {
async test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
I18n.t("categories.all_subcategories")
);
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
I18n.t("categories.no_subcategory")
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
this.get("childCategories.firstObject.name")
@ -67,23 +67,23 @@ componentTest("subcatgories - selection", {
async test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
this.get("childCategories.firstObject.name")
);
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
I18n.t("categories.all_subcategories")
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
I18n.t("categories.no_subcategory")

View File

@ -17,13 +17,13 @@ componentTest("default", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
2
);
assert.notOk(
this.get("subject")
this.subject
.rowByValue(2)
.exists(),
"selected categories are not in the list"
@ -40,16 +40,16 @@ componentTest("with blacklist", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.ok(
this.get("subject")
this.subject
.rowByValue(6)
.exists(),
"not blacklisted categories are in the list"
);
assert.notOk(
this.get("subject")
this.subject
.rowByValue(8)
.exists(),
"blacklisted categories are not in the list"
@ -66,30 +66,30 @@ componentTest("interactions", {
skip: true,
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue(8);
await this.subject.expand();
await this.subject.selectRowByValue(8);
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
"2,6,8",
"it adds the selected category"
);
assert.equal(this.get("categories").length, 3);
assert.equal(this.categories.length, 3);
await this.get("subject").expand();
await this.subject.expand();
await this.get("subject").keyboard("backspace");
await this.get("subject").keyboard("backspace");
await this.subject.keyboard("backspace");
await this.subject.keyboard("backspace");
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
"2,6",
"it removes the last selected category"
);
assert.equal(this.get("categories").length, 2);
assert.equal(this.categories.length, 2);
}
});

View File

@ -13,22 +13,22 @@ componentTest("default", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"hello"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue(1)
.name(),
"hello"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue(2)
.name(),
"world"
@ -46,16 +46,16 @@ componentTest("with valueAttribute", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByValue(0)
.name(),
"hello"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue(1)
.name(),
"world"
@ -70,16 +70,16 @@ componentTest("with nameProperty", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByValue(0)
.name(),
"hello"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue(1)
.name(),
"world"
@ -94,16 +94,16 @@ componentTest("with an array as content", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByValue("evil")
.name(),
"evil"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue("trout")
.name(),
"trout"
@ -120,37 +120,37 @@ componentTest("with value and none as a string", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.noneRow()
.name(),
"none"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue("evil")
.name(),
"evil"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue("trout")
.name(),
"trout"
);
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"trout"
);
assert.equal(this.get("value"), "trout");
assert.equal(this.value, "trout");
await this.get("subject").selectNoneRow();
await this.subject.selectNoneRow();
assert.equal(this.get("value"), null);
assert.equal(this.value, null);
}
});
@ -163,37 +163,37 @@ componentTest("with value and none as an object", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.noneRow()
.name(),
"none"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue("evil")
.name(),
"evil"
);
assert.equal(
this.get("subject")
this.subject
.rowByValue("trout")
.name(),
"trout"
);
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"evil"
);
assert.equal(this.get("value"), "evil");
assert.equal(this.value, "evil");
await this.get("subject").selectNoneRow();
await this.subject.selectNoneRow();
assert.equal(this.get("value"), null);
assert.equal(this.value, null);
}
});
@ -207,10 +207,10 @@ componentTest("with no value and none as an object", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"none"
@ -228,10 +228,10 @@ componentTest("with no value and none string", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"none"
@ -247,10 +247,10 @@ componentTest("with no value and no none", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"evil",
@ -267,10 +267,10 @@ componentTest("with empty string as value", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"evil",
@ -289,10 +289,10 @@ componentTest("with noneLabel", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"none",

View File

@ -10,7 +10,7 @@ componentTest("preview updates with markdown", {
assert.ok(find(".d-editor-button-bar").length);
await fillIn(".d-editor-input", "hello **world**");
assert.equal(this.get("value"), "hello **world**");
assert.equal(this.value, "hello **world**");
assert.equal(
find(".d-editor-preview")
.html()
@ -97,7 +97,7 @@ testCase(`selecting the space before a word`, async function(assert, textarea) {
await click(`button.bold`);
assert.equal(this.get("value"), `hello **w**orld.`);
assert.equal(this.value, `hello **w**orld.`);
assert.equal(textarea.selectionStart, 8);
assert.equal(textarea.selectionEnd, 9);
});
@ -108,7 +108,7 @@ testCase(`selecting the space after a word`, async function(assert, textarea) {
await click(`button.bold`);
assert.equal(this.get("value"), `**hello** world.`);
assert.equal(this.value, `**hello** world.`);
assert.equal(textarea.selectionStart, 2);
assert.equal(textarea.selectionEnd, 7);
});
@ -117,7 +117,7 @@ testCase(`bold button with no selection`, async function(assert, textarea) {
await click(`button.bold`);
const example = I18n.t(`composer.bold_text`);
assert.equal(this.get("value"), `hello world.**${example}**`);
assert.equal(this.value, `hello world.**${example}**`);
assert.equal(textarea.selectionStart, 14);
assert.equal(textarea.selectionEnd, 14 + example.length);
});
@ -127,12 +127,12 @@ testCase(`bold button with a selection`, async function(assert, textarea) {
textarea.selectionEnd = 11;
await click(`button.bold`);
assert.equal(this.get("value"), `hello **world**.`);
assert.equal(this.value, `hello **world**.`);
assert.equal(textarea.selectionStart, 8);
assert.equal(textarea.selectionEnd, 13);
await click(`button.bold`);
assert.equal(this.get("value"), "hello world.");
assert.equal(this.value, "hello world.");
assert.equal(textarea.selectionStart, 6);
assert.equal(textarea.selectionEnd, 11);
});
@ -144,12 +144,12 @@ testCase(`bold with a multiline selection`, async function(assert, textarea) {
textarea.selectionEnd = 12;
await click(`button.bold`);
assert.equal(this.get("value"), `**hello**\n\n**world**\n\ntest.`);
assert.equal(this.value, `**hello**\n\n**world**\n\ntest.`);
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 20);
await click(`button.bold`);
assert.equal(this.get("value"), `hello\n\nworld\n\ntest.`);
assert.equal(this.value, `hello\n\nworld\n\ntest.`);
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 12);
});
@ -157,7 +157,7 @@ testCase(`bold with a multiline selection`, async function(assert, textarea) {
testCase(`italic button with no selection`, async function(assert, textarea) {
await click(`button.italic`);
const example = I18n.t(`composer.italic_text`);
assert.equal(this.get("value"), `hello world.*${example}*`);
assert.equal(this.value, `hello world.*${example}*`);
assert.equal(textarea.selectionStart, 13);
assert.equal(textarea.selectionEnd, 13 + example.length);
@ -168,12 +168,12 @@ testCase(`italic button with a selection`, async function(assert, textarea) {
textarea.selectionEnd = 11;
await click(`button.italic`);
assert.equal(this.get("value"), `hello *world*.`);
assert.equal(this.value, `hello *world*.`);
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 12);
await click(`button.italic`);
assert.equal(this.get("value"), "hello world.");
assert.equal(this.value, "hello world.");
assert.equal(textarea.selectionStart, 6);
assert.equal(textarea.selectionEnd, 11);
});
@ -185,12 +185,12 @@ testCase(`italic with a multiline selection`, async function(assert, textarea) {
textarea.selectionEnd = 12;
await click(`button.italic`);
assert.equal(this.get("value"), `*hello*\n\n*world*\n\ntest.`);
assert.equal(this.value, `*hello*\n\n*world*\n\ntest.`);
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 16);
await click(`button.italic`);
assert.equal(this.get("value"), `hello\n\nworld\n\ntest.`);
assert.equal(this.value, `hello\n\nworld\n\ntest.`);
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 12);
});
@ -203,7 +203,7 @@ testCase("link modal (cancel)", async function(assert) {
await click(".insert-link button.btn-danger");
assert.equal(find(".insert-link.hidden").length, 1);
assert.equal(this.get("value"), "hello world.");
assert.equal(this.value, "hello world.");
});
testCase("link modal (simple link)", async function(assert, textarea) {
@ -214,7 +214,7 @@ testCase("link modal (simple link)", async function(assert, textarea) {
await fillIn(".insert-link input.link-url", url);
await click(".insert-link button.btn-primary");
assert.equal(find(".insert-link.hidden").length, 1);
assert.equal(this.get("value"), `hello world.[${url}](${url})`);
assert.equal(this.value, `hello world.[${url}](${url})`);
assert.equal(textarea.selectionStart, 13);
assert.equal(textarea.selectionEnd, 13 + url.length);
});
@ -223,7 +223,7 @@ testCase("link modal auto http addition", async function(assert) {
await click("button.link");
await fillIn(".insert-link input.link-url", "sam.com");
await click(".insert-link button.btn-primary");
assert.equal(this.get("value"), `hello world.[sam.com](http://sam.com)`);
assert.equal(this.value, `hello world.[sam.com](http://sam.com)`);
});
testCase("link modal (simple link) with selected text", async function(
@ -239,7 +239,7 @@ testCase("link modal (simple link) with selected text", async function(
await fillIn(".insert-link input.link-url", "http://eviltrout.com");
await click(".insert-link button.btn-primary");
assert.equal(find(".insert-link.hidden").length, 1);
assert.equal(this.get("value"), "[hello world.](http://eviltrout.com)");
assert.equal(this.value, "[hello world.](http://eviltrout.com)");
});
testCase("link modal (link with description)", async function(assert) {
@ -249,7 +249,7 @@ testCase("link modal (link with description)", async function(assert) {
await click(".insert-link button.btn-primary");
assert.equal(find(".insert-link.hidden").length, 1);
assert.equal(
this.get("value"),
this.value,
"hello world.[evil trout](http://eviltrout.com)"
);
});
@ -277,7 +277,7 @@ function xyz(x, y, z) {
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`
function xyz(x, y, z) {
if (y === z) {
@ -299,7 +299,7 @@ componentTest("code button", {
const textarea = jumpEnd(find("textarea.d-editor-input")[0]);
await click("button.code");
assert.equal(this.get("value"), ` ${I18n.t("composer.code_text")}`);
assert.equal(this.value, ` ${I18n.t("composer.code_text")}`);
this.set("value", "first line\n\nsecond line\n\nthird line");
@ -308,7 +308,7 @@ componentTest("code button", {
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`first line
${I18n.t("composer.code_text")}
second line
@ -320,7 +320,7 @@ third line`
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`first line
second line
@ -334,7 +334,7 @@ third line\`${I18n.t("composer.code_title")}\``
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`first\`${I18n.t("composer.code_title")}\` line
second line
@ -348,14 +348,14 @@ third line`
await click("button.code");
assert.equal(
this.get("value"),
this.value,
"first `line`\n\nsecond line\n\nthird line"
);
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 11);
await click("button.code");
assert.equal(this.get("value"), "first line\n\nsecond line\n\nthird line");
assert.equal(this.value, "first line\n\nsecond line\n\nthird line");
assert.equal(textarea.selectionStart, 6);
assert.equal(textarea.selectionEnd, 10);
@ -364,14 +364,14 @@ third line`
await click("button.code");
assert.equal(
this.get("value"),
this.value,
" first line\n\n second line\n\nthird line"
);
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 31);
await click("button.code");
assert.equal(this.get("value"), "first line\n\nsecond line\n\nthird line");
assert.equal(this.value, "first line\n\nsecond line\n\nthird line");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 23);
}
@ -388,7 +388,7 @@ componentTest("code fences", {
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`\`\`\`
${I18n.t("composer.paste_code_text")}
\`\`\``
@ -405,7 +405,7 @@ ${I18n.t("composer.paste_code_text")}
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`\`\`\`
first line
second line
@ -425,7 +425,7 @@ third line
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`\`${I18n.t("composer.code_title")}\`first line
second line
third line`
@ -445,7 +445,7 @@ third line`
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`\`first line\`
second line
third line`
@ -462,7 +462,7 @@ third line`
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`\`\`\`
first line
second line
@ -481,7 +481,7 @@ third line`
await click("button.code");
assert.equal(
this.get("value"),
this.value,
`first \n\`\`\`\nline\nsecond\n\`\`\`\n line\nthird line`
);
@ -502,12 +502,12 @@ componentTest("quote button - empty lines", {
await click("button.quote");
assert.equal(this.get("value"), "> one\n> \n> two\n> \n> three");
assert.equal(this.value, "> one\n> \n> two\n> \n> three");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 25);
await click("button.quote");
assert.equal(this.get("value"), "one\n\ntwo\n\nthree");
assert.equal(this.value, "one\n\ntwo\n\nthree");
}
});
@ -523,7 +523,7 @@ componentTest("quote button - selecting empty lines", {
textarea.selectionEnd = 10;
await click("button.quote");
assert.equal(this.get("value"), "one\n\n\n> \n> two");
assert.equal(this.value, "one\n\n\n> \n> two");
}
});
@ -532,13 +532,13 @@ testCase("quote button", async function(assert, textarea) {
textarea.selectionEnd = 9;
await click("button.quote");
assert.equal(this.get("value"), "hello\n\n> wor\n\nld.");
assert.equal(this.value, "hello\n\n> wor\n\nld.");
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 12);
await click("button.quote");
assert.equal(this.get("value"), "hello\n\nwor\n\nld.");
assert.equal(this.value, "hello\n\nwor\n\nld.");
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 10);
@ -546,19 +546,19 @@ testCase("quote button", async function(assert, textarea) {
textarea.selectionEnd = 15;
await click("button.quote");
assert.equal(this.get("value"), "hello\n\nwor\n\nld.\n\n> Blockquote");
assert.equal(this.value, "hello\n\nwor\n\nld.\n\n> Blockquote");
});
testCase(`bullet button with no selection`, async function(assert, textarea) {
const example = I18n.t("composer.list_item");
await click(`button.bullet`);
assert.equal(this.get("value"), `hello world.\n\n* ${example}`);
assert.equal(this.value, `hello world.\n\n* ${example}`);
assert.equal(textarea.selectionStart, 14);
assert.equal(textarea.selectionEnd, 16 + example.length);
await click(`button.bullet`);
assert.equal(this.get("value"), `hello world.\n\n${example}`);
assert.equal(this.value, `hello world.\n\n${example}`);
});
testCase(`bullet button with a selection`, async function(assert, textarea) {
@ -566,12 +566,12 @@ testCase(`bullet button with a selection`, async function(assert, textarea) {
textarea.selectionEnd = 11;
await click(`button.bullet`);
assert.equal(this.get("value"), `hello\n\n* world\n\n.`);
assert.equal(this.value, `hello\n\n* world\n\n.`);
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 14);
await click(`button.bullet`);
assert.equal(this.get("value"), `hello\n\nworld\n\n.`);
assert.equal(this.value, `hello\n\nworld\n\n.`);
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 12);
});
@ -586,12 +586,12 @@ testCase(`bullet button with a multiple line selection`, async function(
textarea.selectionEnd = 20;
await click(`button.bullet`);
assert.equal(this.get("value"), "Hello\n\nWorld\n\nEvil");
assert.equal(this.value, "Hello\n\nWorld\n\nEvil");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 18);
await click(`button.bullet`);
assert.equal(this.get("value"), "* Hello\n\n* World\n\n* Evil");
assert.equal(this.value, "* Hello\n\n* World\n\n* Evil");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 24);
});
@ -600,12 +600,12 @@ testCase(`list button with no selection`, async function(assert, textarea) {
const example = I18n.t("composer.list_item");
await click(`button.list`);
assert.equal(this.get("value"), `hello world.\n\n1. ${example}`);
assert.equal(this.value, `hello world.\n\n1. ${example}`);
assert.equal(textarea.selectionStart, 14);
assert.equal(textarea.selectionEnd, 17 + example.length);
await click(`button.list`);
assert.equal(this.get("value"), `hello world.\n\n${example}`);
assert.equal(this.value, `hello world.\n\n${example}`);
assert.equal(textarea.selectionStart, 14);
assert.equal(textarea.selectionEnd, 14 + example.length);
});
@ -615,12 +615,12 @@ testCase(`list button with a selection`, async function(assert, textarea) {
textarea.selectionEnd = 11;
await click(`button.list`);
assert.equal(this.get("value"), `hello\n\n1. world\n\n.`);
assert.equal(this.value, `hello\n\n1. world\n\n.`);
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 15);
await click(`button.list`);
assert.equal(this.get("value"), `hello\n\nworld\n\n.`);
assert.equal(this.value, `hello\n\nworld\n\n.`);
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 12);
});
@ -632,12 +632,12 @@ testCase(`list button with line sequence`, async function(assert, textarea) {
textarea.selectionEnd = 18;
await click(`button.list`);
assert.equal(this.get("value"), "1. Hello\n\n2. World\n\n3. Evil");
assert.equal(this.value, "1. Hello\n\n2. World\n\n3. Evil");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 27);
await click(`button.list`);
assert.equal(this.get("value"), "Hello\n\nWorld\n\nEvil");
assert.equal(this.value, "Hello\n\nWorld\n\nEvil");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 18);
});
@ -699,7 +699,7 @@ componentTest("emoji", {
await click(
'.emoji-picker .section[data-section="smileys_&_emotion"] button.emoji[title="grinning"]'
);
assert.equal(this.get("value"), "hello world.:grinning:");
assert.equal(this.value, "hello world.:grinning:");
}
});
@ -710,7 +710,7 @@ testCase("replace-text event by default", async function(assert) {
.lookup("app-events:main")
.trigger("composer:replace-text", "green", "yellow");
assert.equal(this.get("value"), "red green blue");
assert.equal(this.value, "red green blue");
});
composerTestCase("replace-text event for composer", async function(assert) {
@ -720,7 +720,7 @@ composerTestCase("replace-text event for composer", async function(assert) {
.lookup("app-events:main")
.trigger("composer:replace-text", "green", "yellow");
assert.equal(this.get("value"), "red yellow blue");
assert.equal(this.value, "red yellow blue");
});
(() => {
@ -823,7 +823,7 @@ composerTestCase("replace-text event for composer", async function(assert) {
let expect = await formatTextWithSelection(AFTER, CASE.after); // eslint-disable-line no-undef
let actual = await formatTextWithSelection( // eslint-disable-line no-undef
this.get("value"),
this.value,
getSelection(textarea)
);
assert.equal(actual, expect);

View File

@ -40,10 +40,10 @@ componentTest("default", {
},
skip: true,
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
"bianca",
@ -51,66 +51,66 @@ componentTest("default", {
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
"régis",
"it has the correct tag"
);
await this.get("subject").fillInFilter("régis");
await this.get("subject").keyboard("enter");
await this.subject.fillInFilter("régis");
await this.subject.keyboard("enter");
assert.deepEqual(
this.get("tags"),
this.tags,
["jeff", "neil", "arpit", "régis"],
"it selects the tag"
);
await this.get("subject").expand();
await this.get("subject").fillInFilter("joffrey");
await this.get("subject").keyboard("enter");
await this.subject.expand();
await this.subject.fillInFilter("joffrey");
await this.subject.keyboard("enter");
assert.deepEqual(
this.get("tags"),
this.tags,
["jeff", "neil", "arpit", "régis", "joffrey"],
"it creates the tag"
);
await this.get("subject").expand();
await this.get("subject").fillInFilter("Joffrey");
await this.get("subject").keyboard("enter");
await this.get("subject").collapse();
await this.subject.expand();
await this.subject.fillInFilter("Joffrey");
await this.subject.keyboard("enter");
await this.subject.collapse();
assert.deepEqual(
this.get("tags"),
this.tags,
["jeff", "neil", "arpit", "régis", "joffrey"],
"it does not allow case insensitive duplicate tags"
);
await this.get("subject").expand();
await this.get("subject").fillInFilter("invalid' Tag");
await this.get("subject").keyboard("enter");
await this.subject.expand();
await this.subject.fillInFilter("invalid' Tag");
await this.subject.keyboard("enter");
assert.deepEqual(
this.get("tags"),
this.tags,
["jeff", "neil", "arpit", "régis", "joffrey", "invalid-tag"],
"it strips invalid characters in tag"
);
await this.get("subject").expand();
await this.get("subject").fillInFilter("01234567890123456789012345");
await this.get("subject").keyboard("enter");
await this.subject.expand();
await this.subject.fillInFilter("01234567890123456789012345");
await this.subject.keyboard("enter");
assert.deepEqual(
this.get("tags"),
this.tags,
["jeff", "neil", "arpit", "régis", "joffrey", "invalid-tag"],
"it does not allow creating long tags"
);
await click(
this.get("subject")
this.subject
.el()
.find(".selected-tag")
.last()
);
assert.deepEqual(
this.get("tags"),
this.tags,
["jeff", "neil", "arpit", "régis", "joffrey"],
"it removes the tag"
);

View File

@ -19,7 +19,7 @@ componentTest("with objects and values", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
"1,2"
@ -58,10 +58,10 @@ componentTest("interactions", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.name(),
"robin",
@ -71,52 +71,52 @@ componentTest("interactions", {
await this.set("none", "test.none");
assert.ok(
this.get("subject")
this.subject
.noneRow()
.exists()
);
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.name(),
"robin",
"it highlights the first content row"
);
await this.get("subject").selectRowByValue(3);
await this.get("subject").expand();
await this.subject.selectRowByValue(3);
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.name(),
"none",
"it highlights none row if no content"
);
await this.get("subject").fillInFilter("joffrey");
await this.subject.fillInFilter("joffrey");
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.name(),
"joffrey",
"it highlights create row when filling filter"
);
await this.get("subject").keyboard("enter");
await this.subject.keyboard("enter");
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.name(),
"none",
"it highlights none row after creating content and no content left"
);
await this.get("subject").keyboard("backspace");
await this.subject.keyboard("backspace");
const $lastSelectedName = this.get("subject")
const $lastSelectedName = this.subject
.header()
.el()
.find(".selected-name")
@ -127,9 +127,9 @@ componentTest("interactions", {
"it highlights the last selected name when using backspace"
);
await this.get("subject").keyboard("backspace");
await this.subject.keyboard("backspace");
const $lastSelectedName1 = this.get("subject")
const $lastSelectedName1 = this.subject
.header()
.el()
.find(".selected-name")
@ -140,15 +140,15 @@ componentTest("interactions", {
"it removes the previous highlighted selected content"
);
assert.notOk(
this.get("subject")
this.subject
.rowByValue("joffrey")
.exists(),
"generated content shouldn’t appear in content when removed"
);
await this.get("subject").keyboard("selectAll");
await this.subject.keyboard("selectAll");
const $highlightedSelectedNames2 = this.get("subject")
const $highlightedSelectedNames2 = this.subject
.header()
.el()
.find(".selected-name.is-highlighted");
@ -158,26 +158,26 @@ componentTest("interactions", {
"it highlights each selected name"
);
await this.get("subject").keyboard("backspace");
await this.subject.keyboard("backspace");
const $selectedNames = this.get("subject")
const $selectedNames = this.subject
.header()
.el()
.find(".selected-name");
assert.equal($selectedNames.length, 0, "it removed all selected content");
assert.ok(this.get("subject").isFocused());
assert.ok(this.get("subject").isExpanded());
assert.ok(this.subject.isFocused());
assert.ok(this.subject.isExpanded());
await this.get("subject").keyboard("escape");
await this.subject.keyboard("escape");
assert.ok(this.get("subject").isFocused());
assert.notOk(this.get("subject").isExpanded());
assert.ok(this.subject.isFocused());
assert.notOk(this.subject.isExpanded());
await this.get("subject").keyboard("escape");
await this.subject.keyboard("escape");
assert.notOk(this.get("subject").isFocused());
assert.notOk(this.get("subject").isExpanded());
assert.notOk(this.subject.isFocused());
assert.notOk(this.subject.isExpanded());
}
});
@ -189,10 +189,10 @@ componentTest("with limitMatches", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.el()
.find(".select-kit-row").length,
2
@ -208,17 +208,17 @@ componentTest("with minimum", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject").validationMessage(),
this.subject.validationMessage(),
"Select at least 1 item."
);
await this.get("subject").selectRowByValue("sam");
await this.subject.selectRowByValue("sam");
assert.equal(
this.get("subject")
this.subject
.header()
.label(),
"sam"
@ -236,14 +236,14 @@ componentTest("with minimumLabel", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(this.get("subject").validationMessage(), "min 1");
assert.equal(this.subject.validationMessage(), "min 1");
await this.get("subject").selectRowByValue("jeff");
await this.subject.selectRowByValue("jeff");
assert.equal(
this.get("subject")
this.subject
.header()
.label(),
"jeff"
@ -259,9 +259,9 @@ componentTest("with forceEscape", {
},
skip: true,
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
const row = this.get("subject").rowByIndex(0);
const row = this.subject.rowByIndex(0);
assert.equal(
row
.el()
@ -271,11 +271,11 @@ componentTest("with forceEscape", {
"<div>sam</div>"
);
await this.get("subject").fillInFilter("<div>jeff</div>");
await this.get("subject").keyboard("enter");
await this.subject.fillInFilter("<div>jeff</div>");
await this.subject.keyboard("enter");
assert.equal(
this.get("subject")
this.subject
.header()
.el()
.find(".name")
@ -294,9 +294,9 @@ componentTest("with forceEscape", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
const row = this.get("subject").rowByIndex(0);
const row = this.subject.rowByIndex(0);
assert.equal(
row
.el()
@ -306,11 +306,11 @@ componentTest("with forceEscape", {
"<div>sam</div>"
);
await this.get("subject").fillInFilter("<div>jeff</div>");
await this.get("subject").keyboard("enter");
await this.subject.fillInFilter("<div>jeff</div>");
await this.subject.keyboard("enter");
assert.equal(
this.get("subject")
this.subject
.header()
.el()
.find(".name")
@ -339,13 +339,13 @@ componentTest("support modifying on select behavior through plugin api", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue(1);
await this.subject.expand();
await this.subject.selectRowByValue(1);
assert.equal(find(".on-select-test").html(), "1");
await this.get("subject").expand();
await this.get("subject").selectRowByValue(2);
await this.subject.expand();
await this.subject.selectRowByValue(2);
assert.equal(
find(".on-select-test").html(),

View File

@ -28,7 +28,7 @@ componentTest("updating the content refreshes the list", {
async test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"pinned"
@ -37,7 +37,7 @@ componentTest("updating the content refreshes the list", {
await this.set("pinned", false);
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"unpinned"

View File

@ -34,7 +34,7 @@ componentTest("adding a value", {
);
assert.deepEqual(
this.get("values"),
this.values,
"firstKey|FirstValue\nsecondKey|secondValue\nthirdKey|thirdValue",
"it adds the value to the list of values"
);
@ -55,7 +55,7 @@ componentTest("adding an invalid value", {
);
assert.deepEqual(
this.get("values"),
this.values,
undefined,
"it doesn't add the value to the list of values"
);
@ -83,7 +83,7 @@ componentTest("removing a value", {
);
assert.equal(
this.get("values"),
this.values,
"secondKey|secondValue",
"it removes the expected value"
);

View File

@ -17,10 +17,10 @@ componentTest("updating the content refreshes the list", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByValue(1)
.name(),
"BEFORE"
@ -29,7 +29,7 @@ componentTest("updating the content refreshes the list", {
await this.set("content", [{ id: 1, name: "AFTER" }]);
assert.equal(
this.get("subject")
this.subject
.rowByValue(1)
.name(),
"AFTER"
@ -46,19 +46,19 @@ componentTest("accepts a value by reference", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.name(),
"robin",
"it highlights the row corresponding to the value"
);
await this.get("subject").selectRowByValue(1);
await this.subject.selectRowByValue(1);
assert.equal(this.get("value"), 1, "it mutates the value");
assert.equal(this.value, 1, "it mutates the value");
}
});
@ -67,7 +67,7 @@ componentTest("no default icon", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.icon().length,
0,
@ -80,11 +80,11 @@ componentTest("default search icon", {
template: "{{single-select filterable=true}}",
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.ok(
exists(
this.get("subject")
this.subject
.filter()
.icon()
),
@ -97,11 +97,11 @@ componentTest("with no search icon", {
template: "{{single-select filterable=true filterIcon=null}}",
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.notOk(
exists(
this.get("subject")
this.subject
.filter()
.icon()
),
@ -114,10 +114,10 @@ componentTest("custom search icon", {
template: '{{single-select filterable=true filterIcon="shower"}}',
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.ok(
this.get("subject")
this.subject
.filter()
.icon()
.hasClass("d-icon-shower"),
@ -129,13 +129,13 @@ componentTest("custom search icon", {
componentTest("is expandable", {
template: "{{single-select}}",
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.ok(this.get("subject").isExpanded());
assert.ok(this.subject.isExpanded());
await this.get("subject").collapse();
await this.subject.collapse();
assert.notOk(this.get("subject").isExpanded());
assert.notOk(this.subject.isExpanded());
}
});
@ -149,10 +149,10 @@ componentTest("accepts custom value/name keys", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.name(),
"robin"
@ -170,7 +170,7 @@ componentTest("doesn’t render collection content before first expand", {
async test(assert) {
assert.notOk(exists(find(".select-kit-collection")));
await this.get("subject").expand();
await this.subject.expand();
assert.ok(exists(find(".select-kit-collection")));
}
@ -184,19 +184,19 @@ componentTest("dynamic headerText", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"robin"
);
await this.get("subject").selectRowByValue(2);
await this.subject.selectRowByValue(2);
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"regis",
@ -216,10 +216,10 @@ componentTest("supports custom row template", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByValue(1)
.el()
.html()
@ -241,10 +241,10 @@ componentTest("supports converting select value to integer", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.name(),
"régis"
@ -253,7 +253,7 @@ componentTest("supports converting select value to integer", {
await this.set("value", 1);
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.name(),
"robin",
@ -274,10 +274,10 @@ componentTest("supports converting string as boolean to boolean", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.name(),
"ASC"
@ -286,7 +286,7 @@ componentTest("supports converting string as boolean to boolean", {
await this.set("value", false);
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.name(),
"DESC",
@ -304,65 +304,65 @@ componentTest("supports keyboard events", {
skip: true,
async test(assert) {
await this.get("subject").expand();
await this.get("subject").keyboard("down");
await this.subject.expand();
await this.subject.keyboard("down");
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.title(),
"regis",
"the next row is highlighted"
);
await this.get("subject").keyboard("down");
await this.subject.keyboard("down");
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.title(),
"robin",
"it returns to the first row"
);
await this.get("subject").keyboard("up");
await this.subject.keyboard("up");
assert.equal(
this.get("subject")
this.subject
.highlightedRow()
.title(),
"regis",
"it highlights the last row"
);
await this.get("subject").keyboard("enter");
await this.subject.keyboard("enter");
assert.equal(
this.get("subject")
this.subject
.selectedRow()
.title(),
"regis",
"it selects the row when pressing enter"
);
assert.notOk(
this.get("subject").isExpanded(),
this.subject.isExpanded(),
"it collapses the select box when selecting a row"
);
await this.get("subject").expand();
await this.get("subject").keyboard("escape");
await this.subject.expand();
await this.subject.keyboard("escape");
assert.notOk(
this.get("subject").isExpanded(),
this.subject.isExpanded(),
"it collapses the select box"
);
await this.get("subject").expand();
await this.get("subject").fillInFilter("regis");
await this.get("subject").keyboard("tab");
await this.subject.expand();
await this.subject.fillInFilter("regis");
await this.subject.keyboard("tab");
assert.notOk(
this.get("subject").isExpanded(),
this.subject.isExpanded(),
"it collapses the select box when selecting a row"
);
}
@ -382,7 +382,7 @@ componentTest("with allowInitialValueMutation", {
test(assert) {
assert.equal(
this.get("value"),
this.value,
"1",
"it mutates the value on initial rendering"
);
@ -402,11 +402,11 @@ componentTest("support appending content through plugin api", {
this.set("content", [{ id: "1", name: "robin" }]);
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(this.get("subject").rows().length, 2);
assert.equal(this.subject.rows().length, 2);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
"regis"
@ -436,11 +436,11 @@ componentTest("support modifying content through plugin api", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(this.get("subject").rows().length, 3);
assert.equal(this.subject.rows().length, 3);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
"sam"
@ -464,11 +464,11 @@ componentTest("support prepending content through plugin api", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(this.get("subject").rows().length, 2);
assert.equal(this.subject.rows().length, 2);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
"regis"
@ -496,13 +496,13 @@ componentTest("support modifying on select behavior through plugin api", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue(1);
await this.subject.expand();
await this.subject.selectRowByValue(1);
assert.equal(find(".on-select-test").html(), "1");
await this.get("subject").expand();
await this.get("subject").selectRowByValue(2);
await this.subject.expand();
await this.subject.selectRowByValue(2);
assert.equal(
find(".on-select-test").html(),
@ -529,10 +529,10 @@ componentTest("support modifying on select none behavior through plugin api", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue(1);
await this.get("subject").expand();
await this.get("subject").selectNoneRow();
await this.subject.expand();
await this.subject.selectRowByValue(1);
await this.subject.expand();
await this.subject.selectNoneRow();
assert.equal(find(".on-select-none-test").html(), "NONE");
@ -545,14 +545,14 @@ componentTest("with nameChanges", {
beforeEach() {
this.set("robin", { id: "1", name: "robin" });
this.set("content", [this.get("robin")]);
this.set("content", [this.robin]);
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"robin"
@ -561,7 +561,7 @@ componentTest("with nameChanges", {
await this.set("robin.name", "robin2");
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"robin2"
@ -577,16 +577,16 @@ componentTest("with null value", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.name(),
"robin"
);
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
undefined
@ -602,7 +602,7 @@ componentTest("with collection header", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.ok(exists(".collection-header h2"));
}
@ -617,7 +617,7 @@ componentTest("with title", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"My title"
@ -643,7 +643,7 @@ componentTest("support modifying header computed content through plugin api", {
test(assert) {
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"Not so evil"
@ -661,10 +661,10 @@ componentTest("with limitMatches", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.el()
.find(".select-kit-row").length,
2
@ -681,17 +681,17 @@ componentTest("with minimum", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject").validationMessage(),
this.subject.validationMessage(),
"Select at least 1 item."
);
await this.get("subject").selectRowByValue("sam");
await this.subject.selectRowByValue("sam");
assert.equal(
this.get("subject")
this.subject
.header()
.label(),
"sam"
@ -709,14 +709,14 @@ componentTest("with minimumLabel", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(this.get("subject").validationMessage(), "min 1");
assert.equal(this.subject.validationMessage(), "min 1");
await this.get("subject").selectRowByValue("jeff");
await this.subject.selectRowByValue("jeff");
assert.equal(
this.get("subject")
this.subject
.header()
.label(),
"jeff"
@ -732,12 +732,12 @@ componentTest("with accents in filter", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").fillInFilter("jéff");
await this.subject.expand();
await this.subject.fillInFilter("jéff");
assert.equal(this.get("subject").rows().length, 1);
assert.equal(this.subject.rows().length, 1);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
"jeff"
@ -753,12 +753,12 @@ componentTest("with accents in content", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").fillInFilter("jeff");
await this.subject.expand();
await this.subject.fillInFilter("jeff");
assert.equal(this.get("subject").rows().length, 1);
assert.equal(this.subject.rows().length, 1);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
"jéff"
@ -772,12 +772,12 @@ componentTest("with no content and allowAny", {
skip: true,
async test(assert) {
await click(
this.get("subject")
this.subject
.header()
.el()
);
const $filter = this.get("subject")
const $filter = this.subject
.filter()
.el();
@ -794,9 +794,9 @@ componentTest("with forceEscape", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
const row = this.get("subject").rowByIndex(0);
const row = this.subject.rowByIndex(0);
assert.equal(
row
.el()
@ -807,7 +807,7 @@ componentTest("with forceEscape", {
);
assert.equal(
this.get("subject")
this.subject
.header()
.el()
.find(".selected-name")
@ -826,9 +826,9 @@ componentTest("without forceEscape", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
const row = this.get("subject").rowByIndex(0);
const row = this.subject.rowByIndex(0);
assert.equal(
row
.el()
@ -839,7 +839,7 @@ componentTest("without forceEscape", {
);
assert.equal(
this.get("subject")
this.subject
.header()
.el()
.find(".selected-name")
@ -863,8 +863,8 @@ componentTest("onSelect", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue("red");
await this.subject.expand();
await this.subject.selectRowByValue("red");
assert.equal(
find(".test-external-action")
@ -888,10 +888,10 @@ componentTest("onDeselect", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue("red");
await this.get("subject").expand();
await this.get("subject").selectRowByValue("blue");
await this.subject.expand();
await this.subject.selectRowByValue("red");
await this.subject.expand();
await this.subject.selectRowByValue("blue");
assert.equal(
find(".test-external-action")
@ -915,13 +915,13 @@ componentTest("noopRow", {
},
async test(assert) {
await this.get("subject").expand();
await this.get("subject").selectRowByValue("red");
assert.equal(this.get("value"), "blue", "it doesn’t change the value");
await this.subject.expand();
await this.subject.selectRowByValue("red");
assert.equal(this.value, "blue", "it doesn’t change the value");
await this.get("subject").expand();
await this.get("subject").selectRowByValue("green");
assert.equal(this.get("value"), "green");
await this.subject.expand();
await this.subject.selectRowByValue("green");
assert.equal(this.value, "green");
}
});

View File

@ -38,10 +38,10 @@ componentTest("default", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
"jeff",
@ -49,25 +49,25 @@ componentTest("default", {
);
assert.equal(
this.get("subject")
this.subject
.rowByIndex(2)
.name(),
"neil",
"it has the correct tag"
);
await this.get("subject").fillInFilter("rég");
await this.subject.fillInFilter("rég");
assert.equal(
this.get("subject")
this.subject
.rowByIndex(0)
.name(),
"régis",
"it displays the searched tag"
);
await this.get("subject").fillInFilter("");
await this.subject.fillInFilter("");
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
"jeff",
@ -75,8 +75,8 @@ componentTest("default", {
);
sandbox.stub(DiscourseURL, "routeTo");
await this.get("subject").fillInFilter("dav");
await this.get("subject").keyboard("enter");
await this.subject.fillInFilter("dav");
await this.subject.keyboard("enter");
assert.ok(
DiscourseURL.routeTo.calledWith("/tags/david"),
"it uses lowercase URLs for tags"
@ -93,10 +93,10 @@ componentTest("no tags", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.rowByIndex(1)
.name(),
undefined,

View File

@ -22,22 +22,22 @@ componentTest("default", {
},
async test(assert) {
await this.get("subject").expand();
await this.subject.expand();
assert.equal(
this.get("subject")
this.subject
.header()
.title(),
"Topic Controls"
);
assert.equal(
this.get("subject")
this.subject
.header()
.value(),
null
);
assert.notOk(
this.get("subject")
this.subject
.selectedRow()
.exists(),
"it doesn’t preselect first row"

View File

@ -18,7 +18,7 @@ componentTest("adding a value", {
);
assert.deepEqual(
this.get("values"),
this.values,
"vinkas\nosama\neviltrout",
"it adds the value to the list of values"
);
@ -38,7 +38,7 @@ componentTest("removing a value", {
"it removes the value from the list of values"
);
assert.equal(this.get("values"), "osama", "it removes the expected value");
assert.equal(this.values, "osama", "it removes the expected value");
}
});
@ -58,7 +58,7 @@ componentTest("selecting a value", {
);
assert.deepEqual(
this.get("values"),
this.values,
"vinkas\nosama\nmaja",
"it adds the value to the list of values"
);
@ -81,7 +81,7 @@ componentTest("array support", {
);
assert.deepEqual(
this.get("values"),
this.values,
["vinkas", "osama", "eviltrout"],
"it adds the value to the list of values"
);
@ -105,7 +105,7 @@ componentTest("delimiter support", {
);
assert.deepEqual(
this.get("values"),
this.values,
"vinkas|osama|eviltrout",
"it adds the value to the list of values"
);