mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 03:37:15 +08:00
apply prettier on gigantic find and replace (#7604)
This commit is contained in:
@ -11,18 +11,8 @@ componentTest("with value", {
|
||||
template: "{{category-chooser value=2}}",
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
2
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"feature"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), 2);
|
||||
assert.equal(this.subject.header().title(), "feature");
|
||||
}
|
||||
});
|
||||
|
||||
@ -32,11 +22,7 @@ componentTest("with excludeCategoryId", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.notOk(
|
||||
this.subject
|
||||
.rowByValue(2)
|
||||
.exists()
|
||||
);
|
||||
assert.notOk(this.subject.rowByValue(2).exists());
|
||||
}
|
||||
});
|
||||
|
||||
@ -47,29 +33,15 @@ componentTest("with scopedCategoryId", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.title(),
|
||||
this.subject.rowByIndex(0).title(),
|
||||
"Discussion about features or potential features of Discourse: how they work, why they work, etc."
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(0).value(), 2);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.value(),
|
||||
2
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.title(),
|
||||
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.subject
|
||||
.rowByIndex(1)
|
||||
.value(),
|
||||
26
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(1).value(), 26);
|
||||
assert.equal(this.subject.rows().length, 2);
|
||||
|
||||
await this.subject.fillInFilter("dev");
|
||||
@ -86,18 +58,8 @@ componentTest("with allowUncategorized=null", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"category"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.equal(this.subject.header().title(), "category");
|
||||
}
|
||||
});
|
||||
|
||||
@ -109,18 +71,8 @@ componentTest("with allowUncategorized=null rootNone=true", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"category"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.equal(this.subject.header().title(), "category");
|
||||
}
|
||||
});
|
||||
|
||||
@ -134,18 +86,8 @@ componentTest("with disallowed uncategorized, rootNone and rootNoneLabel", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"category"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.equal(this.subject.header().title(), "category");
|
||||
}
|
||||
});
|
||||
|
||||
@ -157,18 +99,8 @@ componentTest("with allowed uncategorized", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"uncategorized"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.equal(this.subject.header().title(), "uncategorized");
|
||||
}
|
||||
});
|
||||
|
||||
@ -180,18 +112,8 @@ componentTest("with allowed uncategorized and rootNone", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"(no category)"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.equal(this.subject.header().title(), "(no category)");
|
||||
}
|
||||
});
|
||||
|
||||
@ -205,17 +127,7 @@ componentTest("with allowed uncategorized rootNone and rootNoneLabel", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"root none label"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.equal(this.subject.header().title(), "root none label");
|
||||
}
|
||||
});
|
||||
|
@ -25,25 +25,19 @@ componentTest("subcatgories - no selection", {
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
this.subject.header().title(),
|
||||
I18n.t("categories.all_subcategories")
|
||||
);
|
||||
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
this.subject.rowByIndex(0).name(),
|
||||
I18n.t("categories.no_subcategory")
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
this.subject.rowByIndex(1).name(),
|
||||
this.get("childCategories.firstObject.name")
|
||||
);
|
||||
}
|
||||
@ -67,25 +61,19 @@ componentTest("subcatgories - selection", {
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
this.subject.header().title(),
|
||||
this.get("childCategories.firstObject.name")
|
||||
);
|
||||
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
this.subject.rowByIndex(0).name(),
|
||||
I18n.t("categories.all_subcategories")
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
this.subject.rowByIndex(1).name(),
|
||||
I18n.t("categories.no_subcategory")
|
||||
);
|
||||
}
|
||||
|
@ -16,16 +16,9 @@ componentTest("default", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
2
|
||||
);
|
||||
assert.equal(this.subject.header().value(), 2);
|
||||
assert.notOk(
|
||||
this.subject
|
||||
.rowByValue(2)
|
||||
.exists(),
|
||||
this.subject.rowByValue(2).exists(),
|
||||
"selected categories are not in the list"
|
||||
);
|
||||
}
|
||||
@ -43,15 +36,11 @@ componentTest("with blacklist", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.ok(
|
||||
this.subject
|
||||
.rowByValue(6)
|
||||
.exists(),
|
||||
this.subject.rowByValue(6).exists(),
|
||||
"not blacklisted categories are in the list"
|
||||
);
|
||||
assert.notOk(
|
||||
this.subject
|
||||
.rowByValue(8)
|
||||
.exists(),
|
||||
this.subject.rowByValue(8).exists(),
|
||||
"blacklisted categories are not in the list"
|
||||
);
|
||||
}
|
||||
@ -70,9 +59,7 @@ componentTest("interactions", {
|
||||
await this.subject.selectRowByValue(8);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
this.subject.header().value(),
|
||||
"2,6,8",
|
||||
"it adds the selected category"
|
||||
);
|
||||
@ -84,9 +71,7 @@ componentTest("interactions", {
|
||||
await this.subject.keyboard("backspace");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
this.subject.header().value(),
|
||||
"2,6",
|
||||
"it removes the last selected category"
|
||||
);
|
||||
|
@ -15,24 +15,9 @@ componentTest("default", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"hello"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(1)
|
||||
.name(),
|
||||
"hello"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(2)
|
||||
.name(),
|
||||
"world"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "hello");
|
||||
assert.equal(this.subject.rowByValue(1).name(), "hello");
|
||||
assert.equal(this.subject.rowByValue(2).name(), "world");
|
||||
}
|
||||
});
|
||||
|
||||
@ -48,18 +33,8 @@ componentTest("with valueAttribute", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(0)
|
||||
.name(),
|
||||
"hello"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(1)
|
||||
.name(),
|
||||
"world"
|
||||
);
|
||||
assert.equal(this.subject.rowByValue(0).name(), "hello");
|
||||
assert.equal(this.subject.rowByValue(1).name(), "world");
|
||||
}
|
||||
});
|
||||
|
||||
@ -72,18 +47,8 @@ componentTest("with nameProperty", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(0)
|
||||
.name(),
|
||||
"hello"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(1)
|
||||
.name(),
|
||||
"world"
|
||||
);
|
||||
assert.equal(this.subject.rowByValue(0).name(), "hello");
|
||||
assert.equal(this.subject.rowByValue(1).name(), "world");
|
||||
}
|
||||
});
|
||||
|
||||
@ -96,18 +61,8 @@ componentTest("with an array as content", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue("evil")
|
||||
.name(),
|
||||
"evil"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue("trout")
|
||||
.name(),
|
||||
"trout"
|
||||
);
|
||||
assert.equal(this.subject.rowByValue("evil").name(), "evil");
|
||||
assert.equal(this.subject.rowByValue("trout").name(), "trout");
|
||||
}
|
||||
});
|
||||
|
||||
@ -122,30 +77,10 @@ componentTest("with value and none as a string", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.noneRow()
|
||||
.name(),
|
||||
"none"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue("evil")
|
||||
.name(),
|
||||
"evil"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue("trout")
|
||||
.name(),
|
||||
"trout"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"trout"
|
||||
);
|
||||
assert.equal(this.subject.noneRow().name(), "none");
|
||||
assert.equal(this.subject.rowByValue("evil").name(), "evil");
|
||||
assert.equal(this.subject.rowByValue("trout").name(), "trout");
|
||||
assert.equal(this.subject.header().name(), "trout");
|
||||
assert.equal(this.value, "trout");
|
||||
|
||||
await this.subject.selectNoneRow();
|
||||
@ -165,30 +100,10 @@ componentTest("with value and none as an object", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.noneRow()
|
||||
.name(),
|
||||
"none"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue("evil")
|
||||
.name(),
|
||||
"evil"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue("trout")
|
||||
.name(),
|
||||
"trout"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"evil"
|
||||
);
|
||||
assert.equal(this.subject.noneRow().name(), "none");
|
||||
assert.equal(this.subject.rowByValue("evil").name(), "evil");
|
||||
assert.equal(this.subject.rowByValue("trout").name(), "trout");
|
||||
assert.equal(this.subject.header().name(), "evil");
|
||||
assert.equal(this.value, "evil");
|
||||
|
||||
await this.subject.selectNoneRow();
|
||||
@ -209,12 +124,7 @@ componentTest("with no value and none as an object", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"none"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "none");
|
||||
}
|
||||
});
|
||||
|
||||
@ -230,12 +140,7 @@ componentTest("with no value and none string", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"none"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "none");
|
||||
}
|
||||
});
|
||||
|
||||
@ -250,9 +155,7 @@ componentTest("with no value and no none", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
this.subject.header().name(),
|
||||
"evil",
|
||||
"it sets the first row as value"
|
||||
);
|
||||
@ -270,9 +173,7 @@ componentTest("with empty string as value", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
this.subject.header().name(),
|
||||
"evil",
|
||||
"it sets the first row as value"
|
||||
);
|
||||
@ -292,9 +193,7 @@ componentTest("with noneLabel", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
this.subject.header().name(),
|
||||
"none",
|
||||
"it displays noneLabel as the header name"
|
||||
);
|
||||
|
@ -248,10 +248,7 @@ testCase("link modal (link with description)", async function(assert) {
|
||||
await fillIn(".insert-link input.link-text", "evil trout");
|
||||
await click(".insert-link button.btn-primary");
|
||||
assert.equal(find(".insert-link.hidden").length, 1);
|
||||
assert.equal(
|
||||
this.value,
|
||||
"hello world.[evil trout](http://eviltrout.com)"
|
||||
);
|
||||
assert.equal(this.value, "hello world.[evil trout](http://eviltrout.com)");
|
||||
});
|
||||
|
||||
componentTest("advanced code", {
|
||||
@ -347,10 +344,7 @@ third line`
|
||||
textarea.selectionEnd = 10;
|
||||
|
||||
await click("button.code");
|
||||
assert.equal(
|
||||
this.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, 7);
|
||||
assert.equal(textarea.selectionEnd, 11);
|
||||
|
||||
@ -363,10 +357,7 @@ third line`
|
||||
textarea.selectionEnd = 23;
|
||||
|
||||
await click("button.code");
|
||||
assert.equal(
|
||||
this.value,
|
||||
" first line\n\n second line\n\nthird line"
|
||||
);
|
||||
assert.equal(this.value, " first line\n\n second line\n\nthird line");
|
||||
assert.equal(textarea.selectionStart, 0);
|
||||
assert.equal(textarea.selectionEnd, 31);
|
||||
|
||||
|
@ -43,17 +43,13 @@ componentTest("default", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
this.subject.rowByIndex(0).name(),
|
||||
"bianca",
|
||||
"it has the correct tag"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
this.subject.rowByIndex(1).name(),
|
||||
"régis",
|
||||
"it has the correct tag"
|
||||
);
|
||||
|
@ -18,12 +18,7 @@ componentTest("with objects and values", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
"1,2"
|
||||
);
|
||||
assert.equal(this.subject.header().value(), "1,2");
|
||||
}
|
||||
});
|
||||
|
||||
@ -61,24 +56,16 @@ componentTest("interactions", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.name(),
|
||||
this.subject.highlightedRow().name(),
|
||||
"robin",
|
||||
"it highlights the first content row"
|
||||
);
|
||||
|
||||
await this.set("none", "test.none");
|
||||
|
||||
assert.ok(
|
||||
this.subject
|
||||
.noneRow()
|
||||
.exists()
|
||||
);
|
||||
assert.ok(this.subject.noneRow().exists());
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.name(),
|
||||
this.subject.highlightedRow().name(),
|
||||
"robin",
|
||||
"it highlights the first content row"
|
||||
);
|
||||
@ -87,9 +74,7 @@ componentTest("interactions", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.name(),
|
||||
this.subject.highlightedRow().name(),
|
||||
"none",
|
||||
"it highlights none row if no content"
|
||||
);
|
||||
@ -97,9 +82,7 @@ componentTest("interactions", {
|
||||
await this.subject.fillInFilter("joffrey");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.name(),
|
||||
this.subject.highlightedRow().name(),
|
||||
"joffrey",
|
||||
"it highlights create row when filling filter"
|
||||
);
|
||||
@ -107,9 +90,7 @@ componentTest("interactions", {
|
||||
await this.subject.keyboard("enter");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.name(),
|
||||
this.subject.highlightedRow().name(),
|
||||
"none",
|
||||
"it highlights none row after creating content and no content left"
|
||||
);
|
||||
@ -140,9 +121,7 @@ componentTest("interactions", {
|
||||
"it removes the previous highlighted selected content"
|
||||
);
|
||||
assert.notOk(
|
||||
this.subject
|
||||
.rowByValue("joffrey")
|
||||
.exists(),
|
||||
this.subject.rowByValue("joffrey").exists(),
|
||||
"generated content shouldn’t appear in content when removed"
|
||||
);
|
||||
|
||||
@ -191,12 +170,7 @@ componentTest("with limitMatches", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.el()
|
||||
.find(".select-kit-row").length,
|
||||
2
|
||||
);
|
||||
assert.equal(this.subject.el().find(".select-kit-row").length, 2);
|
||||
}
|
||||
});
|
||||
|
||||
@ -210,19 +184,11 @@ componentTest("with minimum", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject.validationMessage(),
|
||||
"Select at least 1 item."
|
||||
);
|
||||
assert.equal(this.subject.validationMessage(), "Select at least 1 item.");
|
||||
|
||||
await this.subject.selectRowByValue("sam");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.label(),
|
||||
"sam"
|
||||
);
|
||||
assert.equal(this.subject.header().label(), "sam");
|
||||
}
|
||||
});
|
||||
|
||||
@ -242,12 +208,7 @@ componentTest("with minimumLabel", {
|
||||
|
||||
await this.subject.selectRowByValue("jeff");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.label(),
|
||||
"jeff"
|
||||
);
|
||||
assert.equal(this.subject.header().label(), "jeff");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -27,20 +27,10 @@ componentTest("updating the content refreshes the list", {
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"pinned"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "pinned");
|
||||
|
||||
await this.set("pinned", false);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"unpinned"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "unpinned");
|
||||
}
|
||||
});
|
||||
|
@ -19,21 +19,11 @@ componentTest("updating the content refreshes the list", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(1)
|
||||
.name(),
|
||||
"BEFORE"
|
||||
);
|
||||
assert.equal(this.subject.rowByValue(1).name(), "BEFORE");
|
||||
|
||||
await this.set("content", [{ id: 1, name: "AFTER" }]);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByValue(1)
|
||||
.name(),
|
||||
"AFTER"
|
||||
);
|
||||
assert.equal(this.subject.rowByValue(1).name(), "AFTER");
|
||||
}
|
||||
});
|
||||
|
||||
@ -49,9 +39,7 @@ componentTest("accepts a value by reference", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.name(),
|
||||
this.subject.selectedRow().name(),
|
||||
"robin",
|
||||
"it highlights the row corresponding to the value"
|
||||
);
|
||||
@ -67,9 +55,7 @@ componentTest("no default icon", {
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.icon().length,
|
||||
this.subject.header().icon().length,
|
||||
0,
|
||||
"it doesn’t have an icon if not specified"
|
||||
);
|
||||
@ -82,14 +68,7 @@ componentTest("default search icon", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.ok(
|
||||
exists(
|
||||
this.subject
|
||||
.filter()
|
||||
.icon()
|
||||
),
|
||||
"it has an icon"
|
||||
);
|
||||
assert.ok(exists(this.subject.filter().icon()), "it has an icon");
|
||||
}
|
||||
});
|
||||
|
||||
@ -99,14 +78,7 @@ componentTest("with no search icon", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
this.subject
|
||||
.filter()
|
||||
.icon()
|
||||
),
|
||||
"it has no icon"
|
||||
);
|
||||
assert.notOk(exists(this.subject.filter().icon()), "it has no icon");
|
||||
}
|
||||
});
|
||||
|
||||
@ -151,12 +123,7 @@ componentTest("accepts custom value/name keys", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.name(),
|
||||
"robin"
|
||||
);
|
||||
assert.equal(this.subject.selectedRow().name(), "robin");
|
||||
}
|
||||
});
|
||||
|
||||
@ -186,19 +153,12 @@ componentTest("dynamic headerText", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"robin"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "robin");
|
||||
|
||||
await this.subject.selectRowByValue(2);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
this.subject.header().name(),
|
||||
"regis",
|
||||
"it changes header text"
|
||||
);
|
||||
@ -243,19 +203,12 @@ componentTest("supports converting select value to integer", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.name(),
|
||||
"régis"
|
||||
);
|
||||
assert.equal(this.subject.selectedRow().name(), "régis");
|
||||
|
||||
await this.set("value", 1);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.name(),
|
||||
this.subject.selectedRow().name(),
|
||||
"robin",
|
||||
"it works with dynamic content"
|
||||
);
|
||||
@ -276,19 +229,12 @@ componentTest("supports converting string as boolean to boolean", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.name(),
|
||||
"ASC"
|
||||
);
|
||||
assert.equal(this.subject.selectedRow().name(), "ASC");
|
||||
|
||||
await this.set("value", false);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.name(),
|
||||
this.subject.selectedRow().name(),
|
||||
"DESC",
|
||||
"it works with dynamic content"
|
||||
);
|
||||
@ -308,9 +254,7 @@ componentTest("supports keyboard events", {
|
||||
await this.subject.keyboard("down");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.title(),
|
||||
this.subject.highlightedRow().title(),
|
||||
"regis",
|
||||
"the next row is highlighted"
|
||||
);
|
||||
@ -318,9 +262,7 @@ componentTest("supports keyboard events", {
|
||||
await this.subject.keyboard("down");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.title(),
|
||||
this.subject.highlightedRow().title(),
|
||||
"robin",
|
||||
"it returns to the first row"
|
||||
);
|
||||
@ -328,9 +270,7 @@ componentTest("supports keyboard events", {
|
||||
await this.subject.keyboard("up");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.highlightedRow()
|
||||
.title(),
|
||||
this.subject.highlightedRow().title(),
|
||||
"regis",
|
||||
"it highlights the last row"
|
||||
);
|
||||
@ -338,9 +278,7 @@ componentTest("supports keyboard events", {
|
||||
await this.subject.keyboard("enter");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.title(),
|
||||
this.subject.selectedRow().title(),
|
||||
"regis",
|
||||
"it selects the row when pressing enter"
|
||||
);
|
||||
@ -352,10 +290,7 @@ componentTest("supports keyboard events", {
|
||||
await this.subject.expand();
|
||||
await this.subject.keyboard("escape");
|
||||
|
||||
assert.notOk(
|
||||
this.subject.isExpanded(),
|
||||
"it collapses the select box"
|
||||
);
|
||||
assert.notOk(this.subject.isExpanded(), "it collapses the select box");
|
||||
|
||||
await this.subject.expand();
|
||||
await this.subject.fillInFilter("regis");
|
||||
@ -381,11 +316,7 @@ componentTest("with allowInitialValueMutation", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.value,
|
||||
"1",
|
||||
"it mutates the value on initial rendering"
|
||||
);
|
||||
assert.equal(this.value, "1", "it mutates the value on initial rendering");
|
||||
}
|
||||
});
|
||||
|
||||
@ -405,12 +336,7 @@ componentTest("support appending content through plugin api", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(this.subject.rows().length, 2);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
"regis"
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(1).name(), "regis");
|
||||
|
||||
clearCallbacks();
|
||||
}
|
||||
@ -439,12 +365,7 @@ componentTest("support modifying content through plugin api", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(this.subject.rows().length, 3);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
"sam"
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(1).name(), "sam");
|
||||
|
||||
clearCallbacks();
|
||||
}
|
||||
@ -467,12 +388,7 @@ componentTest("support prepending content through plugin api", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(this.subject.rows().length, 2);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
"regis"
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(0).name(), "regis");
|
||||
|
||||
clearCallbacks();
|
||||
}
|
||||
@ -551,21 +467,11 @@ componentTest("with nameChanges", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"robin"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "robin");
|
||||
|
||||
await this.set("robin.name", "robin2");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"robin2"
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "robin2");
|
||||
}
|
||||
});
|
||||
|
||||
@ -579,18 +485,8 @@ componentTest("with null value", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.name(),
|
||||
"robin"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
undefined
|
||||
);
|
||||
assert.equal(this.subject.header().name(), "robin");
|
||||
assert.equal(this.subject.header().value(), undefined);
|
||||
}
|
||||
});
|
||||
|
||||
@ -616,12 +512,7 @@ componentTest("with title", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"My title"
|
||||
);
|
||||
assert.equal(this.subject.header().title(), "My title");
|
||||
}
|
||||
});
|
||||
|
||||
@ -642,12 +533,7 @@ componentTest("support modifying header computed content through plugin api", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"Not so evil"
|
||||
);
|
||||
assert.equal(this.subject.header().title(), "Not so evil");
|
||||
|
||||
clearCallbacks();
|
||||
}
|
||||
@ -663,12 +549,7 @@ componentTest("with limitMatches", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.el()
|
||||
.find(".select-kit-row").length,
|
||||
2
|
||||
);
|
||||
assert.equal(this.subject.el().find(".select-kit-row").length, 2);
|
||||
}
|
||||
});
|
||||
|
||||
@ -683,19 +564,11 @@ componentTest("with minimum", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject.validationMessage(),
|
||||
"Select at least 1 item."
|
||||
);
|
||||
assert.equal(this.subject.validationMessage(), "Select at least 1 item.");
|
||||
|
||||
await this.subject.selectRowByValue("sam");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.label(),
|
||||
"sam"
|
||||
);
|
||||
assert.equal(this.subject.header().label(), "sam");
|
||||
}
|
||||
});
|
||||
|
||||
@ -715,12 +588,7 @@ componentTest("with minimumLabel", {
|
||||
|
||||
await this.subject.selectRowByValue("jeff");
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.label(),
|
||||
"jeff"
|
||||
);
|
||||
assert.equal(this.subject.header().label(), "jeff");
|
||||
}
|
||||
});
|
||||
|
||||
@ -736,12 +604,7 @@ componentTest("with accents in filter", {
|
||||
await this.subject.fillInFilter("jéff");
|
||||
|
||||
assert.equal(this.subject.rows().length, 1);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
"jeff"
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(0).name(), "jeff");
|
||||
}
|
||||
});
|
||||
|
||||
@ -757,12 +620,7 @@ componentTest("with accents in content", {
|
||||
await this.subject.fillInFilter("jeff");
|
||||
|
||||
assert.equal(this.subject.rows().length, 1);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
"jéff"
|
||||
);
|
||||
assert.equal(this.subject.rowByIndex(0).name(), "jéff");
|
||||
}
|
||||
});
|
||||
|
||||
@ -771,15 +629,9 @@ componentTest("with no content and allowAny", {
|
||||
|
||||
skip: true,
|
||||
async test(assert) {
|
||||
await click(
|
||||
this.subject
|
||||
.header()
|
||||
.el()
|
||||
);
|
||||
await click(this.subject.header().el());
|
||||
|
||||
const $filter = this.subject
|
||||
.filter()
|
||||
.el();
|
||||
const $filter = this.subject.filter().el();
|
||||
|
||||
assert.ok($filter.hasClass("is-focused"));
|
||||
assert.ok(!$filter.hasClass("is-hidden"));
|
||||
|
@ -41,35 +41,27 @@ componentTest("default", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
this.subject.rowByIndex(1).name(),
|
||||
"jeff",
|
||||
"it has the correct tag"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(2)
|
||||
.name(),
|
||||
this.subject.rowByIndex(2).name(),
|
||||
"neil",
|
||||
"it has the correct tag"
|
||||
);
|
||||
|
||||
await this.subject.fillInFilter("rég");
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(0)
|
||||
.name(),
|
||||
this.subject.rowByIndex(0).name(),
|
||||
"régis",
|
||||
"it displays the searched tag"
|
||||
);
|
||||
|
||||
await this.subject.fillInFilter("");
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
this.subject.rowByIndex(1).name(),
|
||||
"jeff",
|
||||
"it returns top tags for an empty search"
|
||||
);
|
||||
@ -96,9 +88,7 @@ componentTest("no tags", {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.rowByIndex(1)
|
||||
.name(),
|
||||
this.subject.rowByIndex(1).name(),
|
||||
undefined,
|
||||
"it has no tags and doesn’t crash"
|
||||
);
|
||||
|
@ -24,22 +24,10 @@ componentTest("default", {
|
||||
async test(assert) {
|
||||
await this.subject.expand();
|
||||
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.title(),
|
||||
"Topic Controls"
|
||||
);
|
||||
assert.equal(
|
||||
this.subject
|
||||
.header()
|
||||
.value(),
|
||||
null
|
||||
);
|
||||
assert.equal(this.subject.header().title(), "Topic Controls");
|
||||
assert.equal(this.subject.header().value(), null);
|
||||
assert.notOk(
|
||||
this.subject
|
||||
.selectedRow()
|
||||
.exists(),
|
||||
this.subject.selectedRow().exists(),
|
||||
"it doesn’t preselect first row"
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user