Revert "FEATURE: improves select-box to support category selection on new topic"

This reverts commit 7b4e302677.
This commit is contained in:
Joffrey JAFFEUX
2017-08-23 16:33:03 +02:00
parent 7b4e302677
commit 1d90f6016a
18 changed files with 173 additions and 439 deletions

View File

@@ -99,7 +99,7 @@ QUnit.test("Reply as new topic", assert => {
"it fills composer with the ring string"
);
assert.equal(
find('.category-select-box .select-box-header .current-selection').html().trim(), "feature",
find('.category-combobox').select2('data').text, "feature",
"it fills category selector with the right category"
);
});

View File

@@ -33,7 +33,7 @@ componentTest('accepts a value by reference', {
andThen(() => {
assert.equal(
find(".select-box-row.is-highlighted .text").html().trim(), "robin",
this.$(".select-box-row.is-highlighted .text").html().trim(), "robin",
"it highlights the row corresponding to the value"
);
});
@@ -79,7 +79,7 @@ componentTest('no default icon', {
template: '{{select-box}}',
test(assert) {
assert.equal(find(".select-box-header .icon").length, 0, "it doesnt have an icon if not specified");
assert.equal(this.$(".select-box-header .icon").length, 0, "it doesnt have an icon if not specified");
}
});
@@ -87,7 +87,7 @@ componentTest('customisable icon', {
template: '{{select-box icon="shower"}}',
test(assert) {
assert.equal(find(".select-box-header .icon").html().trim(), "<i class=\"fa fa-shower d-icon d-icon-shower\"></i>", "it has a the correct icon");
assert.equal(this.$(".select-box-header .icon").html().trim(), "<i class=\"fa fa-shower d-icon d-icon-shower\"></i>", "it has a the correct icon");
}
});
@@ -98,7 +98,7 @@ componentTest('default search icon', {
click(".select-box-header");
andThen(() => {
assert.equal(find(".select-box-filter .d-icon-search").length, 1, "it has a the correct icon");
assert.equal(find(".select-box-filter .filter-icon").html().trim(), "<i class=\"fa fa-search d-icon d-icon-search\"></i>", "it has a the correct icon");
});
}
});
@@ -122,7 +122,7 @@ componentTest('custom search icon', {
click(".select-box-header");
andThen(() => {
assert.equal(find(".select-box-filter .d-icon-shower").length, 1, "it has a the correct icon");
assert.equal(find(".select-box-filter .filter-icon").html().trim(), "<i class=\"fa fa-shower d-icon d-icon-shower\"></i>", "it has a the correct icon");
});
}
});
@@ -145,13 +145,13 @@ componentTest('select-box is expandable', {
click(".select-box-header");
andThen(() => {
assert.equal(find(".select-box").hasClass("is-expanded"), true);
assert.equal(this.$(".select-box").hasClass("is-expanded"), true);
});
click(".select-box-header");
andThen(() => {
assert.equal(find(".select-box").hasClass("is-expanded"), false);
assert.equal(this.$(".select-box").hasClass("is-expanded"), false);
});
}
});
@@ -165,10 +165,10 @@ componentTest('accepts custom id/text keys', {
},
test(assert) {
click(".select-box-header");
click(this.$(".select-box-header"));
andThen(() => {
assert.equal(find(".select-box-row.is-highlighted .text").html().trim(), "robin");
assert.equal(this.$(".select-box-row.is-highlighted .text").html().trim(), "robin");
});
}
});
@@ -181,12 +181,12 @@ componentTest('doesnt render collection content before first expand', {
},
test(assert) {
assert.equal(find(".select-box-body .collection").length, 0);
assert.equal(this.$(".select-box-body .collection").length, 0);
click(".select-box-header");
click(this.$(".select-box-header"));
andThen(() => {
assert.equal(find(".select-box-body .collection").length, 1);
assert.equal(this.$(".select-box-body .collection").length, 1);
});
}
});
@@ -199,76 +199,42 @@ componentTest('persists filter state when expandind/collapsing', {
},
test(assert) {
click(".select-box-header");
click(this.$(".select-box-header"));
fillIn('.filter-query', 'rob');
triggerEvent('.filter-query', 'keyup');
andThen(() => {
assert.equal(find(".select-box-row").length, 1);
assert.equal(this.$(".select-box-row").length, 1);
});
click(".select-box-header");
click(this.$(".select-box-header"));
andThen(() => {
assert.equal(find(".select-box").hasClass("is-expanded"), false);
assert.equal(this.$().hasClass("is-expanded"), false);
});
click(".select-box-header");
click(this.$(".select-box-header"));
andThen(() => {
assert.equal(find(".select-box-row").length, 1);
assert.equal(this.$(".select-box-row").length, 1);
});
}
});
componentTest('supports options to limit size', {
template: '{{select-box width=50 maxCollectionHeight=20 content=content}}',
template: '{{select-box maxWidth=100 maxCollectionHeight=20 content=content}}',
beforeEach() {
this.set("content", [{ id: 1, text: "robin" }]);
},
test(assert) {
click(".select-box-header");
assert.equal(this.$(".select-box-header").outerWidth(), 100, "it limits the width");
click(this.$(".select-box-header"));
andThen(() => {
assert.equal(find(".select-box-body").height(), 20, "it limits the height");
assert.equal(find(".select-box").width(), 50, "it limits the width");
});
}
});
componentTest('supports custom row template', {
template: '{{select-box content=content selectBoxRowTemplate=selectBoxRowTemplate}}',
beforeEach() {
this.set("content", [{ id: 1, text: "robin" }]);
this.set("selectBoxRowTemplate", (rowComponent) => {
return `<b>${rowComponent.get("text")}</b>`;
});
},
test(assert) {
click(".select-box-header");
andThen(() => {
assert.equal(find(".select-box-row").html().trim(), "<b>robin</b>");
});
}
});
componentTest('supports converting select value to integer', {
template: '{{select-box value=2 content=content castInteger=true}}',
beforeEach() {
this.set("content", [{ id: "1", text: "robin"}, {id: "2", text: "régis" }]);
},
test(assert) {
click(".select-box-header");
andThen(() => {
assert.equal(find(".select-box-row.is-highlighted .text").text(), "régis");
assert.equal(this.$(".select-box-body").height(), 20, "it limits the height");
});
}
});