mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 10:42:45 +08:00
apply prettier on gigantic find and replace (#7604)
This commit is contained in:
parent
373b8a2139
commit
d93f753b17
|
@ -15,9 +15,7 @@ export default Ember.Component.extend({
|
||||||
{
|
{
|
||||||
data: rawData.map(r => r.y),
|
data: rawData.map(r => r.y),
|
||||||
label: model.get("title"),
|
label: model.get("title"),
|
||||||
backgroundColor: `rgba(200,220,240,${
|
backgroundColor: `rgba(200,220,240,${this.type === "bar" ? 1 : 0.3})`,
|
||||||
this.type === "bar" ? 1 : 0.3
|
|
||||||
})`,
|
|
||||||
borderColor: "#08C"
|
borderColor: "#08C"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -75,11 +75,7 @@ export default Ember.Component.extend({
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
if (this.report) {
|
if (this.report) {
|
||||||
this._renderReport(
|
this._renderReport(this.report, this.forcedModes, this.currentMode);
|
||||||
this.report,
|
|
||||||
this.forcedModes,
|
|
||||||
this.currentMode
|
|
||||||
);
|
|
||||||
} else if (this.dataSourceName) {
|
} else if (this.dataSourceName) {
|
||||||
this._fetchReport();
|
this._fetchReport();
|
||||||
}
|
}
|
||||||
|
@ -271,11 +267,7 @@ export default Ember.Component.extend({
|
||||||
this.set("showFilteringUI", false);
|
this.set("showFilteringUI", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._renderReport(
|
this._renderReport(report, this.forcedModes, this.currentMode);
|
||||||
report,
|
|
||||||
this.forcedModes,
|
|
||||||
this.currentMode
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderReport(report, forcedModes, currentMode) {
|
_renderReport(report, forcedModes, currentMode) {
|
||||||
|
|
|
@ -46,10 +46,7 @@ export default Ember.Component.extend(bufferedProperty("host"), {
|
||||||
host
|
host
|
||||||
.save(props)
|
.save(props)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
host.set(
|
host.set("category", Discourse.Category.findById(this.categoryId));
|
||||||
"category",
|
|
||||||
Discourse.Category.findById(this.categoryId)
|
|
||||||
);
|
|
||||||
this.set("editToggled", false);
|
this.set("editToggled", false);
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
|
@ -58,11 +55,9 @@ export default Ember.Component.extend(bufferedProperty("host"), {
|
||||||
delete() {
|
delete() {
|
||||||
bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => {
|
bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.host
|
this.host.destroyRecord().then(() => {
|
||||||
.destroyRecord()
|
this.deleteHost(this.host);
|
||||||
.then(() => {
|
});
|
||||||
this.deleteHost(this.host);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,8 +19,8 @@ export default Ember.Component.extend({
|
||||||
this.set("show", true);
|
this.set("show", true);
|
||||||
|
|
||||||
if (!this.location) {
|
if (!this.location) {
|
||||||
ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(
|
ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(location =>
|
||||||
location => this.set("location", Ember.Object.create(location))
|
this.set("location", Ember.Object.create(location))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,7 @@ export default Ember.Component.extend(
|
||||||
buffer.push(iconHTML(icon));
|
buffer.push(iconHTML(icon));
|
||||||
buffer.push("<span class='ru-label'>" + this.text + "</span>");
|
buffer.push("<span class='ru-label'>" + this.text + "</span>");
|
||||||
buffer.push(
|
buffer.push(
|
||||||
"<span class='ru-progress' style='width:" +
|
"<span class='ru-progress' style='width:" + this.progress + "%'></span>"
|
||||||
this.progress +
|
|
||||||
"%'></span>"
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
addValue() {
|
addValue() {
|
||||||
if (this._checkInvalidInput([this.newKey, this.newSecret]))
|
if (this._checkInvalidInput([this.newKey, this.newSecret])) return;
|
||||||
return;
|
|
||||||
this._addValue(this.newKey, this.newSecret);
|
this._addValue(this.newKey, this.newSecret);
|
||||||
this.setProperties({ newKey: "", newSecret: "" });
|
this.setProperties({ newKey: "", newSecret: "" });
|
||||||
},
|
},
|
||||||
|
|
|
@ -79,10 +79,7 @@ export default Ember.Component.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set(
|
this.set("values", this.collection.join(this.inputDelimiter || "\n"));
|
||||||
"values",
|
|
||||||
this.collection.join(this.inputDelimiter || "\n")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_splitValues(values, delimiter) {
|
_splitValues(values, delimiter) {
|
||||||
|
|
|
@ -29,9 +29,7 @@ export default Ember.Component.extend({
|
||||||
@computed("word")
|
@computed("word")
|
||||||
isUniqueWord(word) {
|
isUniqueWord(word) {
|
||||||
const words = this.filteredContent || [];
|
const words = this.filteredContent || [];
|
||||||
const filtered = words.filter(
|
const filtered = words.filter(content => content.action === this.actionKey);
|
||||||
content => content.action === this.actionKey
|
|
||||||
);
|
|
||||||
return filtered.every(
|
return filtered.every(
|
||||||
content => content.word.toLowerCase() !== word.toLowerCase()
|
content => content.word.toLowerCase() !== word.toLowerCase()
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,10 +23,7 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
newColorSchemeWithBase(baseKey) {
|
newColorSchemeWithBase(baseKey) {
|
||||||
const base = this.baseColorSchemes.findBy(
|
const base = this.baseColorSchemes.findBy("base_scheme_id", baseKey);
|
||||||
"base_scheme_id",
|
|
||||||
baseKey
|
|
||||||
);
|
|
||||||
const newColorScheme = Ember.copy(base, true);
|
const newColorScheme = Ember.copy(base, true);
|
||||||
newColorScheme.setProperties({
|
newColorScheme.setProperties({
|
||||||
name: I18n.t("admin.customize.colors.new_name"),
|
name: I18n.t("admin.customize.colors.new_name"),
|
||||||
|
|
|
@ -36,30 +36,18 @@ export default Ember.Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
save() {
|
save() {
|
||||||
this.set("saving", true);
|
this.set("saving", true);
|
||||||
this.model
|
this.model.saveChanges("theme_fields").finally(() => {
|
||||||
.saveChanges("theme_fields")
|
this.set("saving", false);
|
||||||
.finally(() => {
|
});
|
||||||
this.set("saving", false);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fieldAdded(target, name) {
|
fieldAdded(target, name) {
|
||||||
this.replaceRoute(
|
this.replaceRoute(this.editRouteName, this.get("model.id"), target, name);
|
||||||
this.editRouteName,
|
|
||||||
this.get("model.id"),
|
|
||||||
target,
|
|
||||||
name
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onlyOverriddenChanged(onlyShowOverridden) {
|
onlyOverriddenChanged(onlyShowOverridden) {
|
||||||
if (onlyShowOverridden) {
|
if (onlyShowOverridden) {
|
||||||
if (
|
if (!this.model.hasEdited(this.currentTargetName, this.fieldName)) {
|
||||||
!this.model.hasEdited(
|
|
||||||
this.currentTargetName,
|
|
||||||
this.fieldName
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
let firstTarget = this.get("model.targets").find(t => t.edited);
|
let firstTarget = this.get("model.targets").find(t => t.edited);
|
||||||
let firstField = this.get(`model.fields.${firstTarget.name}`).find(
|
let firstField = this.get(`model.fields.${firstTarget.name}`).find(
|
||||||
f => f.edited
|
f => f.edited
|
||||||
|
|
|
@ -39,11 +39,7 @@ export default Ember.Controller.extend({
|
||||||
this.set("sendingEmail", true);
|
this.set("sendingEmail", true);
|
||||||
this.set("sentEmail", false);
|
this.set("sentEmail", false);
|
||||||
|
|
||||||
EmailPreview.sendDigest(
|
EmailPreview.sendDigest(this.username, this.lastSeen, this.email)
|
||||||
this.username,
|
|
||||||
this.lastSeen,
|
|
||||||
this.email
|
|
||||||
)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.errors) {
|
if (result.errors) {
|
||||||
bootbox.alert(result.errors);
|
bootbox.alert(result.errors);
|
||||||
|
|
|
@ -12,9 +12,7 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
let filter;
|
let filter;
|
||||||
if (this.filter) {
|
if (this.filter) {
|
||||||
filter = this.filter
|
filter = this.filter.toLowerCase().trim();
|
||||||
.toLowerCase()
|
|
||||||
.trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!filter || 0 === filter.length) && !this.onlyOverridden) {
|
if ((!filter || 0 === filter.length) && !this.onlyOverridden) {
|
||||||
|
|
|
@ -209,9 +209,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||||
this.adminTools.showSuspendModal(this.model);
|
this.adminTools.showSuspendModal(this.model);
|
||||||
},
|
},
|
||||||
unsuspend() {
|
unsuspend() {
|
||||||
this.model
|
this.model.unsuspend().catch(popupAjaxError);
|
||||||
.unsuspend()
|
|
||||||
.catch(popupAjaxError);
|
|
||||||
},
|
},
|
||||||
showSilenceModal() {
|
showSilenceModal() {
|
||||||
this.adminTools.showSilenceModal(this.model);
|
this.adminTools.showSilenceModal(this.model);
|
||||||
|
|
|
@ -92,9 +92,7 @@ export default Ember.Controller.extend({
|
||||||
.save()
|
.save()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.set("saved", true);
|
this.set("saved", true);
|
||||||
this.adminWebHooks
|
this.adminWebHooks.get("model").addObject(model);
|
||||||
.get("model")
|
|
||||||
.addObject(model);
|
|
||||||
|
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
this.transitionToRoute("adminWebHooks.show", model.get("id"));
|
this.transitionToRoute("adminWebHooks.show", model.get("id"));
|
||||||
|
@ -135,9 +133,7 @@ export default Ember.Controller.extend({
|
||||||
model
|
model
|
||||||
.destroyRecord()
|
.destroyRecord()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.adminWebHooks
|
this.adminWebHooks.get("model").removeObject(model);
|
||||||
.get("model")
|
|
||||||
.removeObject(model);
|
|
||||||
this.transitionToRoute("adminWebHooks");
|
this.transitionToRoute("adminWebHooks");
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
|
|
|
@ -273,10 +273,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
this.set("loading", true);
|
this.set("loading", true);
|
||||||
ajax(this.importUrl, options)
|
ajax(this.importUrl, options)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
const theme = this.store.createRecord(
|
const theme = this.store.createRecord(this.recordType, result.theme);
|
||||||
this.recordType,
|
|
||||||
result.theme
|
|
||||||
);
|
|
||||||
this.adminCustomizeThemes.send("addTheme", theme);
|
this.adminCustomizeThemes.send("addTheme", theme);
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
})
|
})
|
||||||
|
|
|
@ -76,12 +76,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||||
@observes("hex")
|
@observes("hex")
|
||||||
hexValueChanged() {
|
hexValueChanged() {
|
||||||
if (this.hex) {
|
if (this.hex) {
|
||||||
this.set(
|
this.set("hex", this.hex.toString().replace(/[^0-9a-fA-F]/g, ""));
|
||||||
"hex",
|
|
||||||
this.hex
|
|
||||||
.toString()
|
|
||||||
.replace(/[^0-9a-fA-F]/g, "")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,9 @@ const ScreenedIpAddress = Discourse.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
return ajax(
|
return ajax("/admin/logs/screened_ip_addresses/" + this.id + ".json", {
|
||||||
"/admin/logs/screened_ip_addresses/" + this.id + ".json",
|
type: "DELETE"
|
||||||
{ type: "DELETE" }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -50,23 +50,17 @@ export default Discourse.Model.extend({
|
||||||
topics_viewed: this.topics_viewed >= this.min_topics_viewed,
|
topics_viewed: this.topics_viewed >= this.min_topics_viewed,
|
||||||
posts_read: this.posts_read >= this.min_posts_read,
|
posts_read: this.posts_read >= this.min_posts_read,
|
||||||
topics_viewed_all_time:
|
topics_viewed_all_time:
|
||||||
this.topics_viewed_all_time >=
|
this.topics_viewed_all_time >= this.min_topics_viewed_all_time,
|
||||||
this.min_topics_viewed_all_time,
|
|
||||||
posts_read_all_time:
|
posts_read_all_time:
|
||||||
this.posts_read_all_time >= this.min_posts_read_all_time,
|
this.posts_read_all_time >= this.min_posts_read_all_time,
|
||||||
flagged_posts:
|
flagged_posts: this.num_flagged_posts <= this.max_flagged_posts,
|
||||||
this.num_flagged_posts <= this.max_flagged_posts,
|
flagged_by_users: this.num_flagged_by_users <= this.max_flagged_by_users,
|
||||||
flagged_by_users:
|
|
||||||
this.num_flagged_by_users <= this.max_flagged_by_users,
|
|
||||||
likes_given: this.num_likes_given >= this.min_likes_given,
|
likes_given: this.num_likes_given >= this.min_likes_given,
|
||||||
likes_received:
|
likes_received: this.num_likes_received >= this.min_likes_received,
|
||||||
this.num_likes_received >= this.min_likes_received,
|
|
||||||
likes_received_days:
|
likes_received_days:
|
||||||
this.num_likes_received_days >=
|
this.num_likes_received_days >= this.min_likes_received_days,
|
||||||
this.min_likes_received_days,
|
|
||||||
likes_received_users:
|
likes_received_users:
|
||||||
this.num_likes_received_users >=
|
this.num_likes_received_users >= this.min_likes_received_users,
|
||||||
this.min_likes_received_users,
|
|
||||||
level_locked: this.trust_level_locked,
|
level_locked: this.trust_level_locked,
|
||||||
silenced: this.get("penalty_counts.silenced") === 0,
|
silenced: this.get("penalty_counts.silenced") === 0,
|
||||||
suspended: this.get("penalty_counts.suspended") === 0
|
suspended: this.get("penalty_counts.suspended") === 0
|
||||||
|
|
|
@ -24,9 +24,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
self.$("input").autocomplete({
|
self.$("input").autocomplete({
|
||||||
allowAny: false,
|
allowAny: false,
|
||||||
items: _.isArray(this.badgeNames)
|
items: _.isArray(this.badgeNames) ? this.badgeNames : [this.badgeNames],
|
||||||
? this.badgeNames
|
|
||||||
: [this.badgeNames],
|
|
||||||
single: this.single,
|
single: this.single,
|
||||||
updateData: opts && opts.updateData ? opts.updateData : false,
|
updateData: opts && opts.updateData ? opts.updateData : false,
|
||||||
onChangeItems: function(items) {
|
onChangeItems: function(items) {
|
||||||
|
|
|
@ -11,16 +11,12 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed("categories.[].uploaded_logo.url")
|
@computed("categories.[].uploaded_logo.url")
|
||||||
anyLogos() {
|
anyLogos() {
|
||||||
return this.categories.any(
|
return this.categories.any(c => !Ember.isEmpty(c.get("uploaded_logo.url")));
|
||||||
c => !Ember.isEmpty(c.get("uploaded_logo.url"))
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("categories.[].subcategories")
|
@computed("categories.[].subcategories")
|
||||||
hasSubcategories() {
|
hasSubcategories() {
|
||||||
return this.categories.any(
|
return this.categories.any(c => !Ember.isEmpty(c.get("subcategories")));
|
||||||
c => !Ember.isEmpty(c.get("subcategories"))
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
|
|
|
@ -87,10 +87,7 @@ export default Ember.Component.extend(KeyEnterEscape, {
|
||||||
|
|
||||||
@observes("composeState")
|
@observes("composeState")
|
||||||
disableFullscreen() {
|
disableFullscreen() {
|
||||||
if (
|
if (this.composeState !== Composer.OPEN && positioningWorkaround.blur) {
|
||||||
this.composeState !== Composer.OPEN &&
|
|
||||||
positioningWorkaround.blur
|
|
||||||
) {
|
|
||||||
positioningWorkaround.blur();
|
positioningWorkaround.blur();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -341,14 +341,7 @@ export default Ember.Component.extend({
|
||||||
this.set("shouldBuildScrollMap", false);
|
this.set("shouldBuildScrollMap", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ember.run.throttle(
|
Ember.run.throttle(this, $callback, $input, $preview, this.scrollMap, 20);
|
||||||
this,
|
|
||||||
$callback,
|
|
||||||
$input,
|
|
||||||
$preview,
|
|
||||||
this.scrollMap,
|
|
||||||
20
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_teardownInputPreviewSync() {
|
_teardownInputPreviewSync() {
|
||||||
|
@ -739,10 +732,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
this._setUploadPlaceholderSend(data);
|
this._setUploadPlaceholderSend(data);
|
||||||
|
|
||||||
this.appEvents.trigger(
|
this.appEvents.trigger("composer:insert-text", this.uploadPlaceholder);
|
||||||
"composer:insert-text",
|
|
||||||
this.uploadPlaceholder
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data.xhr && data.originalFiles.length === 1) {
|
if (data.xhr && data.originalFiles.length === 1) {
|
||||||
this.set("isCancellable", true);
|
this.set("isCancellable", true);
|
||||||
|
@ -963,11 +953,7 @@ export default Ember.Component.extend({
|
||||||
unshift: true
|
unshift: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (this.allowUpload && this.uploadIcon && !this.site.mobileView) {
|
||||||
this.allowUpload &&
|
|
||||||
this.uploadIcon &&
|
|
||||||
!this.site.mobileView
|
|
||||||
) {
|
|
||||||
toolbar.addButton({
|
toolbar.addButton({
|
||||||
id: "upload",
|
id: "upload",
|
||||||
group: "insertions",
|
group: "insertions",
|
||||||
|
|
|
@ -64,9 +64,7 @@ export default Ember.Component.extend({
|
||||||
titleMaxLength() {
|
titleMaxLength() {
|
||||||
// maxLength gets in the way of pasting long links, so don't use it if featured links are allowed.
|
// maxLength gets in the way of pasting long links, so don't use it if featured links are allowed.
|
||||||
// Validation will display a message if titles are too long.
|
// Validation will display a message if titles are too long.
|
||||||
return this.watchForLink
|
return this.watchForLink ? null : this.siteSettings.max_topic_title_length;
|
||||||
? null
|
|
||||||
: this.siteSettings.max_topic_title_length;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("composer.titleLength", "watchForLink")
|
@observes("composer.titleLength", "watchForLink")
|
||||||
|
|
|
@ -27,10 +27,7 @@ export default Ember.Component.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (topicCount < this.requiredTopics || postCount < this.requiredPosts) {
|
||||||
topicCount < this.requiredTopics ||
|
|
||||||
postCount < this.requiredPosts
|
|
||||||
) {
|
|
||||||
this.set("enabled", true);
|
this.set("enabled", true);
|
||||||
this.fetchLiveStats();
|
this.fetchLiveStats();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,7 @@ export default Ember.Component.extend({
|
||||||
click() {
|
click() {
|
||||||
if (typeof this.action === "string") {
|
if (typeof this.action === "string") {
|
||||||
this.sendAction("action", this.actionParam);
|
this.sendAction("action", this.actionParam);
|
||||||
} else if (
|
} else if (typeof this.action === "object" && this.action.value) {
|
||||||
typeof this.action === "object" &&
|
|
||||||
this.action.value
|
|
||||||
) {
|
|
||||||
this.action.value(this.actionParam);
|
this.action.value(this.actionParam);
|
||||||
} else if (typeof this.action === "function") {
|
} else if (typeof this.action === "function") {
|
||||||
this.action(this.actionParam);
|
this.action(this.actionParam);
|
||||||
|
|
|
@ -39,16 +39,14 @@ const DiscoveryTopicsListComponent = Ember.Component.extend(
|
||||||
actions: {
|
actions: {
|
||||||
loadMore() {
|
loadMore() {
|
||||||
Discourse.updateContextCount(0);
|
Discourse.updateContextCount(0);
|
||||||
this.model
|
this.model.loadMore().then(hasMoreResults => {
|
||||||
.loadMore()
|
Ember.run.schedule("afterRender", () => this.saveScrollPosition());
|
||||||
.then(hasMoreResults => {
|
if (!hasMoreResults) {
|
||||||
Ember.run.schedule("afterRender", () => this.saveScrollPosition());
|
this.eyeline.flushRest();
|
||||||
if (!hasMoreResults) {
|
} else if ($(window).height() >= $(document).height()) {
|
||||||
this.eyeline.flushRest();
|
this.send("loadMore");
|
||||||
} else if ($(window).height() >= $(document).height()) {
|
}
|
||||||
this.send("loadMore");
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,7 @@ export default Ember.Component.extend({
|
||||||
if (Ember.isEmpty(this.get("model.usernames"))) {
|
if (Ember.isEmpty(this.get("model.usernames"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.model
|
this.model.addMembers(this.get("model.usernames")).catch(popupAjaxError);
|
||||||
.addMembers(this.get("model.usernames"))
|
|
||||||
.catch(popupAjaxError);
|
|
||||||
this.set("model.usernames", null);
|
this.set("model.usernames", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,7 @@ export default Ember.Component.extend(
|
||||||
buildBuffer(buffer) {
|
buildBuffer(buffer) {
|
||||||
const reason = this.get("validation.reason");
|
const reason = this.get("validation.reason");
|
||||||
if (reason) {
|
if (reason) {
|
||||||
buffer.push(
|
buffer.push(iconHTML(this.good ? "check" : "times") + " " + reason);
|
||||||
iconHTML(this.good ? "check" : "times") + " " + reason
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -127,9 +127,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed("inviteModel", "inviteModel.details.can_invite_via_email")
|
@computed("inviteModel", "inviteModel.details.can_invite_via_email")
|
||||||
canInviteViaEmail(inviteModel, canInviteViaEmail) {
|
canInviteViaEmail(inviteModel, canInviteViaEmail) {
|
||||||
return this.inviteModel === this.currentUser
|
return this.inviteModel === this.currentUser ? true : canInviteViaEmail;
|
||||||
? true
|
|
||||||
: canInviteViaEmail;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("isPM", "canInviteViaEmail")
|
@computed("isPM", "canInviteViaEmail")
|
||||||
|
@ -184,10 +182,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed("emailOrUsername")
|
@computed("emailOrUsername")
|
||||||
showCustomMessage(emailOrUsername) {
|
showCustomMessage(emailOrUsername) {
|
||||||
return (
|
return this.inviteModel === this.currentUser || emailValid(emailOrUsername);
|
||||||
this.inviteModel === this.currentUser ||
|
|
||||||
emailValid(emailOrUsername)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Instructional text for the modal.
|
// Instructional text for the modal.
|
||||||
|
@ -386,11 +381,7 @@ export default Ember.Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return model
|
return model
|
||||||
.generateInviteLink(
|
.generateInviteLink(this.emailOrUsername.trim(), groupNames, topicId)
|
||||||
this.emailOrUsername.trim(),
|
|
||||||
groupNames,
|
|
||||||
topicId
|
|
||||||
)
|
|
||||||
.then(result => {
|
.then(result => {
|
||||||
model.setProperties({
|
model.setProperties({
|
||||||
saving: false,
|
saving: false,
|
||||||
|
|
|
@ -181,9 +181,7 @@ export default Ember.Component.extend(
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
toggleBookmark() {
|
toggleBookmark() {
|
||||||
this.topic
|
this.topic.toggleBookmark().finally(() => this.rerenderBuffer());
|
||||||
.toggleBookmark()
|
|
||||||
.finally(() => this.rerenderBuffer());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -173,8 +173,7 @@ export default Ember.Controller.extend(
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.get("emailValidation.ok") &&
|
this.get("emailValidation.ok") &&
|
||||||
(Ember.isEmpty(this.accountUsername) ||
|
(Ember.isEmpty(this.accountUsername) || this.get("authOptions.email"))
|
||||||
this.get("authOptions.email"))
|
|
||||||
) {
|
) {
|
||||||
// If email is valid and username has not been entered yet,
|
// If email is valid and username has not been entered yet,
|
||||||
// or email and username were filled automatically by 3rd parth auth,
|
// or email and username were filled automatically by 3rd parth auth,
|
||||||
|
|
|
@ -85,9 +85,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
this.set("model.closed", result.closed);
|
this.set("model.closed", result.closed);
|
||||||
} else {
|
} else {
|
||||||
const topicTimer =
|
const topicTimer =
|
||||||
this.isPublic === "true"
|
this.isPublic === "true" ? "topic_timer" : "private_topic_timer";
|
||||||
? "topic_timer"
|
|
||||||
: "private_topic_timer";
|
|
||||||
this.set(`model.${topicTimer}`, Ember.Object.create({}));
|
this.set(`model.${topicTimer}`, Ember.Object.create({}));
|
||||||
|
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
|
|
|
@ -291,9 +291,7 @@ export default Ember.Controller.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
selectAll() {
|
selectAll() {
|
||||||
this.selected.addObjects(
|
this.selected.addObjects(this.get("model.posts").map(r => r.topic));
|
||||||
this.get("model.posts").map(r => r.topic)
|
|
||||||
);
|
|
||||||
// Doing this the proper way is a HUGE pain,
|
// Doing this the proper way is a HUGE pain,
|
||||||
// we can hack this to work by observing each on the array
|
// we can hack this to work by observing each on the array
|
||||||
// in the component, however, when we select ANYTHING, we would force
|
// in the component, however, when we select ANYTHING, we would force
|
||||||
|
|
|
@ -180,9 +180,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
@computed("model.previous_hidden", "model.current_hidden", "displayingInline")
|
@computed("model.previous_hidden", "model.current_hidden", "displayingInline")
|
||||||
hiddenClasses(prevHidden, currentHidden, displayingInline) {
|
hiddenClasses(prevHidden, currentHidden, displayingInline) {
|
||||||
if (displayingInline) {
|
if (displayingInline) {
|
||||||
return this.isEitherRevisionHidden
|
return this.isEitherRevisionHidden ? "hidden-revision-either" : null;
|
||||||
? "hidden-revision-either"
|
|
||||||
: null;
|
|
||||||
} else {
|
} else {
|
||||||
var result = [];
|
var result = [];
|
||||||
if (prevHidden) {
|
if (prevHidden) {
|
||||||
|
|
|
@ -97,9 +97,7 @@ export default Ember.Controller.extend(
|
||||||
result.errors.password &&
|
result.errors.password &&
|
||||||
result.errors.password.length > 0
|
result.errors.password.length > 0
|
||||||
) {
|
) {
|
||||||
this.rejectedPasswords.pushObject(
|
this.rejectedPasswords.pushObject(this.accountPassword);
|
||||||
this.accountPassword
|
|
||||||
);
|
|
||||||
this.rejectedPasswordsMessages.set(
|
this.rejectedPasswordsMessages.set(
|
||||||
this.accountPassword,
|
this.accountPassword,
|
||||||
result.errors.password[0]
|
result.errors.password[0]
|
||||||
|
|
|
@ -15,10 +15,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
actions: {
|
actions: {
|
||||||
jump() {
|
jump() {
|
||||||
if (this.postNumber) {
|
if (this.postNumber) {
|
||||||
this._jumpToIndex(
|
this._jumpToIndex(this.filteredPostsCount, this.postNumber);
|
||||||
this.filteredPostsCount,
|
|
||||||
this.postNumber
|
|
||||||
);
|
|
||||||
} else if (this.postDate) {
|
} else if (this.postDate) {
|
||||||
this._jumpToDate(this.postDate);
|
this._jumpToDate(this.postDate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,7 @@ export default Ember.Controller.extend(PasswordValidation, {
|
||||||
result.errors.password &&
|
result.errors.password &&
|
||||||
result.errors.password.length > 0
|
result.errors.password.length > 0
|
||||||
) {
|
) {
|
||||||
this.rejectedPasswords.pushObject(
|
this.rejectedPasswords.pushObject(this.accountPassword);
|
||||||
this.accountPassword
|
|
||||||
);
|
|
||||||
this.rejectedPasswordsMessages.set(
|
this.rejectedPasswordsMessages.set(
|
||||||
this.accountPassword,
|
this.accountPassword,
|
||||||
result.errors.password[0]
|
result.errors.password[0]
|
||||||
|
|
|
@ -61,23 +61,21 @@ export default Ember.Controller.extend({
|
||||||
const self = this;
|
const self = this;
|
||||||
this.set("saving", true);
|
this.set("saving", true);
|
||||||
|
|
||||||
return this.model
|
return this.model.changeEmail(this.newEmail).then(
|
||||||
.changeEmail(this.newEmail)
|
() => self.set("success", true),
|
||||||
.then(
|
e => {
|
||||||
() => self.set("success", true),
|
self.setProperties({ error: true, saving: false });
|
||||||
e => {
|
if (
|
||||||
self.setProperties({ error: true, saving: false });
|
e.jqXHR.responseJSON &&
|
||||||
if (
|
e.jqXHR.responseJSON.errors &&
|
||||||
e.jqXHR.responseJSON &&
|
e.jqXHR.responseJSON.errors[0]
|
||||||
e.jqXHR.responseJSON.errors &&
|
) {
|
||||||
e.jqXHR.responseJSON.errors[0]
|
self.set("errorMessage", e.jqXHR.responseJSON.errors[0]);
|
||||||
) {
|
} else {
|
||||||
self.set("errorMessage", e.jqXHR.responseJSON.errors[0]);
|
self.set("errorMessage", I18n.t("user.change_email.error"));
|
||||||
} else {
|
|
||||||
self.set("errorMessage", I18n.t("user.change_email.error"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,9 +75,7 @@ export default Ember.Controller.extend({
|
||||||
.changeUsername(this.newUsername)
|
.changeUsername(this.newUsername)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
DiscourseURL.redirectTo(
|
DiscourseURL.redirectTo(
|
||||||
userPath(
|
userPath(this.newUsername.toLowerCase() + "/preferences")
|
||||||
this.newUsername.toLowerCase() + "/preferences"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
|
|
|
@ -25,9 +25,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
|
||||||
if (!user.get("ignored")) {
|
if (!user.get("ignored")) {
|
||||||
const usernames = this.ignoredUsernames
|
const usernames = this.ignoredUsernames
|
||||||
.split(",")
|
.split(",")
|
||||||
.removeAt(
|
.removeAt(this.ignoredUsernames.split(",").length - 1)
|
||||||
this.ignoredUsernames.split(",").length - 1
|
|
||||||
)
|
|
||||||
.join(",");
|
.join(",");
|
||||||
this.set("ignoredUsernames", usernames);
|
this.set("ignoredUsernames", usernames);
|
||||||
}
|
}
|
||||||
|
@ -36,9 +34,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return this.model
|
return this.model.save(["ignored_usernames"]).catch(popupAjaxError);
|
||||||
.save(["ignored_usernames"])
|
|
||||||
.catch(popupAjaxError);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
|
|
|
@ -14,12 +14,10 @@ export default Ember.Controller.extend({
|
||||||
destroy => {
|
destroy => {
|
||||||
if (destroy) {
|
if (destroy) {
|
||||||
const c = this.get("tagGroups.model");
|
const c = this.get("tagGroups.model");
|
||||||
return this.model
|
return this.model.destroy().then(() => {
|
||||||
.destroy()
|
c.removeObject(this.model);
|
||||||
.then(() => {
|
this.transitionToRoute("tagGroups");
|
||||||
c.removeObject(this.model);
|
});
|
||||||
this.transitionToRoute("tagGroups");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -607,16 +607,14 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||||
} else if (post) {
|
} else if (post) {
|
||||||
return post.toggleBookmark().catch(popupAjaxError);
|
return post.toggleBookmark().catch(popupAjaxError);
|
||||||
} else {
|
} else {
|
||||||
return this.model
|
return this.model.toggleBookmark().then(changedIds => {
|
||||||
.toggleBookmark()
|
if (!changedIds) {
|
||||||
.then(changedIds => {
|
return;
|
||||||
if (!changedIds) {
|
}
|
||||||
return;
|
changedIds.forEach(id =>
|
||||||
}
|
this.appEvents.trigger("post-stream:refresh", { id })
|
||||||
changedIds.forEach(id =>
|
);
|
||||||
this.appEvents.trigger("post-stream:refresh", { id })
|
});
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -842,11 +840,9 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||||
toggleClosed() {
|
toggleClosed() {
|
||||||
const topic = this.model;
|
const topic = this.model;
|
||||||
|
|
||||||
this.model
|
this.model.toggleStatus("closed").then(result => {
|
||||||
.toggleStatus("closed")
|
topic.set("topic_status_update", result.topic_status_update);
|
||||||
.then(result => {
|
});
|
||||||
topic.set("topic_status_update", result.topic_status_update);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
recoverTopic() {
|
recoverTopic() {
|
||||||
|
@ -1044,9 +1040,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
postStream.loadPostByPostNumber(postNumber).then(p => {
|
postStream.loadPostByPostNumber(postNumber).then(p => {
|
||||||
DiscourseURL.routeTo(
|
DiscourseURL.routeTo(this.model.urlForPostNumber(p.get("post_number")));
|
||||||
this.model.urlForPostNumber(p.get("post_number"))
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1197,10 +1191,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||||
},
|
},
|
||||||
|
|
||||||
postSelected(post) {
|
postSelected(post) {
|
||||||
return (
|
return this.selectedAllPost || this.selectedPostIds.includes(post.id);
|
||||||
this.selectedAllPost ||
|
|
||||||
this.selectedPostIds.includes(post.id)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
|
|
|
@ -26,11 +26,9 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
@observes("searchTerm")
|
@observes("searchTerm")
|
||||||
_searchTermChanged: debounce(function() {
|
_searchTermChanged: debounce(function() {
|
||||||
Invite.findInvitedBy(
|
Invite.findInvitedBy(this.user, this.filter, this.searchTerm).then(
|
||||||
this.user,
|
invites => this.set("model", invites)
|
||||||
this.filter,
|
);
|
||||||
this.searchTerm
|
|
||||||
).then(invites => this.set("model", invites));
|
|
||||||
}, 250),
|
}, 250),
|
||||||
|
|
||||||
inviteRedeemed: Ember.computed.equal("filter", "redeemed"),
|
inviteRedeemed: Ember.computed.equal("filter", "redeemed"),
|
||||||
|
|
|
@ -106,8 +106,7 @@ export default Ember.Mixin.create({
|
||||||
}.on("didInsertElement"),
|
}.on("didInsertElement"),
|
||||||
|
|
||||||
_destroy: function() {
|
_destroy: function() {
|
||||||
this.messageBus &&
|
this.messageBus && this.messageBus.unsubscribe("/uploads/" + this.type);
|
||||||
this.messageBus.unsubscribe("/uploads/" + this.type);
|
|
||||||
|
|
||||||
const $upload = this.$();
|
const $upload = this.$();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -4,9 +4,7 @@ import RestModel from "discourse/models/rest";
|
||||||
export default RestModel.extend({
|
export default RestModel.extend({
|
||||||
@computed("name")
|
@computed("name")
|
||||||
i18nNameKey() {
|
i18nNameKey() {
|
||||||
return this.name
|
return this.name.toLowerCase().replace(/\s/g, "_");
|
||||||
.toLowerCase()
|
|
||||||
.replace(/\s/g, "_");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("name")
|
@computed("name")
|
||||||
|
|
|
@ -41,33 +41,27 @@ const Group = RestModel.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const offset = Math.min(
|
const offset = Math.min(this.user_count, Math.max(this.offset, 0));
|
||||||
this.user_count,
|
|
||||||
Math.max(this.offset, 0)
|
return Group.loadMembers(this.name, offset, this.limit, params).then(
|
||||||
|
result => {
|
||||||
|
var ownerIds = {};
|
||||||
|
result.owners.forEach(owner => (ownerIds[owner.id] = true));
|
||||||
|
|
||||||
|
this.setProperties({
|
||||||
|
user_count: result.meta.total,
|
||||||
|
limit: result.meta.limit,
|
||||||
|
offset: result.meta.offset,
|
||||||
|
members: result.members.map(member => {
|
||||||
|
if (ownerIds[member.id]) {
|
||||||
|
member.owner = true;
|
||||||
|
}
|
||||||
|
return User.create(member);
|
||||||
|
}),
|
||||||
|
owners: result.owners.map(owner => User.create(owner))
|
||||||
|
});
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return Group.loadMembers(
|
|
||||||
this.name,
|
|
||||||
offset,
|
|
||||||
this.limit,
|
|
||||||
params
|
|
||||||
).then(result => {
|
|
||||||
var ownerIds = {};
|
|
||||||
result.owners.forEach(owner => (ownerIds[owner.id] = true));
|
|
||||||
|
|
||||||
this.setProperties({
|
|
||||||
user_count: result.meta.total,
|
|
||||||
limit: result.meta.limit,
|
|
||||||
offset: result.meta.offset,
|
|
||||||
members: result.members.map(member => {
|
|
||||||
if (ownerIds[member.id]) {
|
|
||||||
member.owner = true;
|
|
||||||
}
|
|
||||||
return User.create(member);
|
|
||||||
}),
|
|
||||||
owners: result.owners.map(owner => User.create(owner))
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
removeOwner(member) {
|
removeOwner(member) {
|
||||||
|
@ -251,16 +245,14 @@ const Group = RestModel.extend({
|
||||||
data.category_id = parseInt(opts.categoryId);
|
data.category_id = parseInt(opts.categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ajax(`/groups/${this.name}/${type}.json`, { data }).then(
|
return ajax(`/groups/${this.name}/${type}.json`, { data }).then(posts => {
|
||||||
posts => {
|
return posts.map(p => {
|
||||||
return posts.map(p => {
|
p.user = User.create(p.user);
|
||||||
p.user = User.create(p.user);
|
p.topic = Topic.create(p.topic);
|
||||||
p.topic = Topic.create(p.topic);
|
p.category = Category.findById(p.category_id);
|
||||||
p.category = Category.findById(p.category_id);
|
return Ember.Object.create(p);
|
||||||
return Ember.Object.create(p);
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setNotification(notification_level, userId) {
|
setNotification(notification_level, userId) {
|
||||||
|
|
|
@ -3,25 +3,17 @@ import computed from "ember-addons/ember-computed-decorators";
|
||||||
const LoginMethod = Ember.Object.extend({
|
const LoginMethod = Ember.Object.extend({
|
||||||
@computed
|
@computed
|
||||||
title() {
|
title() {
|
||||||
return (
|
return this.title_override || I18n.t(`login.${this.name}.title`);
|
||||||
this.title_override || I18n.t(`login.${this.name}.title`)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
prettyName() {
|
prettyName() {
|
||||||
return (
|
return this.pretty_name_override || I18n.t(`login.${this.name}.name`);
|
||||||
this.pretty_name_override ||
|
|
||||||
I18n.t(`login.${this.name}.name`)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
message() {
|
message() {
|
||||||
return (
|
return this.message_override || I18n.t("login." + this.name + ".message");
|
||||||
this.message_override ||
|
|
||||||
I18n.t("login." + this.name + ".message")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
doLogin({ reconnect = false, fullScreenLogin = true } = {}) {
|
doLogin({ reconnect = false, fullScreenLogin = true } = {}) {
|
||||||
|
|
|
@ -487,9 +487,7 @@ export default RestModel.extend({
|
||||||
**/
|
**/
|
||||||
undoPost(post) {
|
undoPost(post) {
|
||||||
this.stream.removeObject(-1);
|
this.stream.removeObject(-1);
|
||||||
this.postsWithPlaceholders.removePost(() =>
|
this.postsWithPlaceholders.removePost(() => this.posts.removeObject(post));
|
||||||
this.posts.removeObject(post)
|
|
||||||
);
|
|
||||||
this._identityMap[-1] = null;
|
this._identityMap[-1] = null;
|
||||||
|
|
||||||
const topic = this.topic;
|
const topic = this.topic;
|
||||||
|
@ -520,9 +518,7 @@ export default RestModel.extend({
|
||||||
|
|
||||||
if (!posts.includes(stored)) {
|
if (!posts.includes(stored)) {
|
||||||
if (!this.loadingBelow) {
|
if (!this.loadingBelow) {
|
||||||
this.postsWithPlaceholders.appendPost(() =>
|
this.postsWithPlaceholders.appendPost(() => posts.pushObject(stored));
|
||||||
posts.pushObject(stored)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
posts.pushObject(stored);
|
posts.pushObject(stored);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,7 @@ const Post = RestModel.extend({
|
||||||
internalLinks() {
|
internalLinks() {
|
||||||
if (Ember.isEmpty(this.link_counts)) return null;
|
if (Ember.isEmpty(this.link_counts)) return null;
|
||||||
|
|
||||||
return this.link_counts
|
return this.link_counts.filterBy("internal").filterBy("title");
|
||||||
.filterBy("internal")
|
|
||||||
.filterBy("title");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("actions_summary.@each.can_act")
|
@computed("actions_summary.@each.can_act")
|
||||||
|
|
|
@ -69,11 +69,7 @@ const Topic = RestModel.extend({
|
||||||
const maxUserCount = 5;
|
const maxUserCount = 5;
|
||||||
const posterCount = users.length;
|
const posterCount = users.length;
|
||||||
|
|
||||||
if (
|
if (this.isPrivateMessage && participants && posterCount < maxUserCount) {
|
||||||
this.isPrivateMessage &&
|
|
||||||
participants &&
|
|
||||||
posterCount < maxUserCount
|
|
||||||
) {
|
|
||||||
let pushOffset = 0;
|
let pushOffset = 0;
|
||||||
if (posterCount > 1) {
|
if (posterCount > 1) {
|
||||||
const lastUser = users[posterCount - 1];
|
const lastUser = users[posterCount - 1];
|
||||||
|
|
|
@ -50,13 +50,9 @@ const UserAction = RestModel.extend({
|
||||||
|
|
||||||
if (this.postReplyType) {
|
if (this.postReplyType) {
|
||||||
if (this.reply_to_post_number) {
|
if (this.reply_to_post_number) {
|
||||||
return this.sameUser
|
return this.sameUser ? "you_replied_to_post" : "user_replied_to_post";
|
||||||
? "you_replied_to_post"
|
|
||||||
: "user_replied_to_post";
|
|
||||||
} else {
|
} else {
|
||||||
return this.sameUser
|
return this.sameUser ? "you_replied_to_topic" : "user_replied_to_topic";
|
||||||
? "you_replied_to_topic"
|
|
||||||
: "user_replied_to_topic";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,9 +60,7 @@ const UserAction = RestModel.extend({
|
||||||
if (this.sameUser) {
|
if (this.sameUser) {
|
||||||
return "you_mentioned_user";
|
return "you_mentioned_user";
|
||||||
} else {
|
} else {
|
||||||
return this.targetUser
|
return this.targetUser ? "user_mentioned_you" : "user_mentioned_user";
|
||||||
? "user_mentioned_you"
|
|
||||||
: "user_mentioned_user";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -102,20 +96,12 @@ const UserAction = RestModel.extend({
|
||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
postUrl() {
|
postUrl() {
|
||||||
return postUrl(
|
return postUrl(this.slug, this.topic_id, this.post_number);
|
||||||
this.slug,
|
|
||||||
this.topic_id,
|
|
||||||
this.post_number
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
replyUrl() {
|
replyUrl() {
|
||||||
return postUrl(
|
return postUrl(this.slug, this.topic_id, this.reply_to_post_number);
|
||||||
this.slug,
|
|
||||||
this.topic_id,
|
|
||||||
this.reply_to_post_number
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
replyType: Ember.computed.equal("action_type", UserActionTypes.replies),
|
replyType: Ember.computed.equal("action_type", UserActionTypes.replies),
|
||||||
|
|
|
@ -24,11 +24,7 @@ export default RestModel.extend({
|
||||||
postUrl(topicId) {
|
postUrl(topicId) {
|
||||||
if (!topicId) return;
|
if (!topicId) return;
|
||||||
|
|
||||||
return postUrl(
|
return postUrl(this.slug, this.topic_id, this.post_number);
|
||||||
this.slug,
|
|
||||||
this.topic_id,
|
|
||||||
this.post_number
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("draft_key")
|
@computed("draft_key")
|
||||||
|
|
|
@ -218,13 +218,10 @@ const User = RestModel.extend({
|
||||||
silencedTillDate: longDate,
|
silencedTillDate: longDate,
|
||||||
|
|
||||||
changeUsername(new_username) {
|
changeUsername(new_username) {
|
||||||
return ajax(
|
return ajax(userPath(`${this.username_lower}/preferences/username`), {
|
||||||
userPath(`${this.username_lower}/preferences/username`),
|
type: "PUT",
|
||||||
{
|
data: { new_username }
|
||||||
type: "PUT",
|
});
|
||||||
data: { new_username }
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeEmail(email) {
|
changeEmail(email) {
|
||||||
|
@ -390,13 +387,10 @@ const User = RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
revokeAssociatedAccount(providerName) {
|
revokeAssociatedAccount(providerName) {
|
||||||
return ajax(
|
return ajax(userPath(`${this.username}/preferences/revoke-account`), {
|
||||||
userPath(`${this.username}/preferences/revoke-account`),
|
data: { provider_name: providerName },
|
||||||
{
|
type: "POST"
|
||||||
data: { provider_name: providerName },
|
});
|
||||||
type: "POST"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loadUserAction(id) {
|
loadUserAction(id) {
|
||||||
|
@ -528,17 +522,17 @@ const User = RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
pickAvatar(upload_id, type) {
|
pickAvatar(upload_id, type) {
|
||||||
return ajax(
|
return ajax(userPath(`${this.username_lower}/preferences/avatar/pick`), {
|
||||||
userPath(`${this.username_lower}/preferences/avatar/pick`),
|
type: "PUT",
|
||||||
{ type: "PUT", data: { upload_id, type } }
|
data: { upload_id, type }
|
||||||
);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
selectAvatar(avatarUrl) {
|
selectAvatar(avatarUrl) {
|
||||||
return ajax(
|
return ajax(userPath(`${this.username_lower}/preferences/avatar/select`), {
|
||||||
userPath(`${this.username_lower}/preferences/avatar/select`),
|
type: "PUT",
|
||||||
{ type: "PUT", data: { url: avatarUrl } }
|
data: { url: avatarUrl }
|
||||||
);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
isAllowedToUploadAFile(type) {
|
isAllowedToUploadAFile(type) {
|
||||||
|
@ -657,49 +651,47 @@ const User = RestModel.extend({
|
||||||
// let { store } = this; would fail in tests
|
// let { store } = this; would fail in tests
|
||||||
const store = Discourse.__container__.lookup("service:store");
|
const store = Discourse.__container__.lookup("service:store");
|
||||||
|
|
||||||
return ajax(userPath(`${this.username_lower}/summary.json`)).then(
|
return ajax(userPath(`${this.username_lower}/summary.json`)).then(json => {
|
||||||
json => {
|
const summary = json.user_summary;
|
||||||
const summary = json.user_summary;
|
const topicMap = {};
|
||||||
const topicMap = {};
|
const badgeMap = {};
|
||||||
const badgeMap = {};
|
|
||||||
|
|
||||||
json.topics.forEach(
|
json.topics.forEach(
|
||||||
t => (topicMap[t.id] = store.createRecord("topic", t))
|
t => (topicMap[t.id] = store.createRecord("topic", t))
|
||||||
);
|
);
|
||||||
Badge.createFromJson(json).forEach(b => (badgeMap[b.id] = b));
|
Badge.createFromJson(json).forEach(b => (badgeMap[b.id] = b));
|
||||||
|
|
||||||
summary.topics = summary.topic_ids.map(id => topicMap[id]);
|
summary.topics = summary.topic_ids.map(id => topicMap[id]);
|
||||||
|
|
||||||
summary.replies.forEach(r => {
|
summary.replies.forEach(r => {
|
||||||
r.topic = topicMap[r.topic_id];
|
r.topic = topicMap[r.topic_id];
|
||||||
r.url = r.topic.urlForPostNumber(r.post_number);
|
r.url = r.topic.urlForPostNumber(r.post_number);
|
||||||
r.createdAt = new Date(r.created_at);
|
r.createdAt = new Date(r.created_at);
|
||||||
|
});
|
||||||
|
|
||||||
|
summary.links.forEach(l => {
|
||||||
|
l.topic = topicMap[l.topic_id];
|
||||||
|
l.post_url = l.topic.urlForPostNumber(l.post_number);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (summary.badges) {
|
||||||
|
summary.badges = summary.badges.map(ub => {
|
||||||
|
const badge = badgeMap[ub.badge_id];
|
||||||
|
badge.count = ub.count;
|
||||||
|
return badge;
|
||||||
});
|
});
|
||||||
|
|
||||||
summary.links.forEach(l => {
|
|
||||||
l.topic = topicMap[l.topic_id];
|
|
||||||
l.post_url = l.topic.urlForPostNumber(l.post_number);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (summary.badges) {
|
|
||||||
summary.badges = summary.badges.map(ub => {
|
|
||||||
const badge = badgeMap[ub.badge_id];
|
|
||||||
badge.count = ub.count;
|
|
||||||
return badge;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (summary.top_categories) {
|
|
||||||
summary.top_categories.forEach(c => {
|
|
||||||
if (c.parent_category_id) {
|
|
||||||
c.parentCategory = Category.findById(c.parent_category_id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return summary;
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
if (summary.top_categories) {
|
||||||
|
summary.top_categories.forEach(c => {
|
||||||
|
if (c.parent_category_id) {
|
||||||
|
c.parentCategory = Category.findById(c.parent_category_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return summary;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
canManageGroup(group) {
|
canManageGroup(group) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ export default Discourse.Route.extend(ViewingActionType, {
|
||||||
afterModel(model, transition) {
|
afterModel(model, transition) {
|
||||||
return model.filterBy({
|
return model.filterBy({
|
||||||
filter: this.userActionType,
|
filter: this.userActionType,
|
||||||
noContentHelpKey:
|
noContentHelpKey: this.noContentHelpKey || "user_activity.no_default",
|
||||||
this.noContentHelpKey || "user_activity.no_default",
|
|
||||||
actingUsername: transition.to.queryParams.acting_username
|
actingUsername: transition.to.queryParams.acting_username
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,8 +46,7 @@ export default MultiSelectComponent.extend({
|
||||||
const blacklist = Ember.makeArray(this.blacklist);
|
const blacklist = Ember.makeArray(this.blacklist);
|
||||||
return Category.list().filter(category => {
|
return Category.list().filter(category => {
|
||||||
return (
|
return (
|
||||||
this.categories.includes(category) ||
|
this.categories.includes(category) || !blacklist.includes(category)
|
||||||
!blacklist.includes(category)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,7 @@ export default MultiSelectComponent.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
computeValues() {
|
computeValues() {
|
||||||
return this.settingValue
|
return this.settingValue.split(this.tokenSeparator).filter(c => c);
|
||||||
.split(this.tokenSeparator)
|
|
||||||
.filter(c => c);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleTabOnKeyDown(event) {
|
_handleTabOnKeyDown(event) {
|
||||||
|
|
|
@ -154,8 +154,7 @@ export default ComboBox.extend(TagsMixin, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.hasReachedMinimum && isEmpty(this.selection)) {
|
if (!this.hasReachedMinimum && isEmpty(this.selection)) {
|
||||||
const key =
|
const key = this.minimumLabel || "select_kit.min_content_not_reached";
|
||||||
this.minimumLabel || "select_kit.min_content_not_reached";
|
|
||||||
const label = I18n.t(key, { count: this.minimum });
|
const label = I18n.t(key, { count: this.minimum });
|
||||||
content.title = content.name = content.label = label;
|
content.title = content.name = content.label = label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,14 +168,11 @@ export default SelectKitComponent.extend({
|
||||||
|
|
||||||
if (this.noneLabel) {
|
if (this.noneLabel) {
|
||||||
if (!this.hasSelection) {
|
if (!this.hasSelection) {
|
||||||
content.title = content.name = content.label = I18n.t(
|
content.title = content.name = content.label = I18n.t(this.noneLabel);
|
||||||
this.noneLabel
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!this.hasReachedMinimum) {
|
if (!this.hasReachedMinimum) {
|
||||||
const key =
|
const key = this.minimumLabel || "select_kit.min_content_not_reached";
|
||||||
this.minimumLabel || "select_kit.min_content_not_reached";
|
|
||||||
content.title = content.name = content.label = I18n.t(key, {
|
content.title = content.name = content.label = I18n.t(key, {
|
||||||
count: this.minimum
|
count: this.minimum
|
||||||
});
|
});
|
||||||
|
@ -243,10 +240,7 @@ export default SelectKitComponent.extend({
|
||||||
if (isEmpty(this.collectionComputedContent)) {
|
if (isEmpty(this.collectionComputedContent)) {
|
||||||
if (this.createRowComputedContent) {
|
if (this.createRowComputedContent) {
|
||||||
this.highlight(this.createRowComputedContent);
|
this.highlight(this.createRowComputedContent);
|
||||||
} else if (
|
} else if (this.noneRowComputedContent && this.hasSelection) {
|
||||||
this.noneRowComputedContent &&
|
|
||||||
this.hasSelection
|
|
||||||
) {
|
|
||||||
this.highlight(this.noneRowComputedContent);
|
this.highlight(this.noneRowComputedContent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -260,10 +254,7 @@ export default SelectKitComponent.extend({
|
||||||
!computedContentItem ||
|
!computedContentItem ||
|
||||||
computedContentItem.__sk_row_type === "noneRow"
|
computedContentItem.__sk_row_type === "noneRow"
|
||||||
) {
|
) {
|
||||||
applyOnSelectNonePluginApiCallbacks(
|
applyOnSelectNonePluginApiCallbacks(this.pluginApiIdentifiers, this);
|
||||||
this.pluginApiIdentifiers,
|
|
||||||
this
|
|
||||||
);
|
|
||||||
this._boundaryActionHandler("onSelectNone");
|
this._boundaryActionHandler("onSelectNone");
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -157,9 +157,7 @@ export default SelectKitComponent.extend({
|
||||||
|
|
||||||
@computed("selection")
|
@computed("selection")
|
||||||
hasSelection(selection) {
|
hasSelection(selection) {
|
||||||
return (
|
return selection !== this.noneRowComputedContent && !isNone(selection);
|
||||||
selection !== this.noneRowComputedContent && !isNone(selection)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed(
|
@computed(
|
||||||
|
@ -180,19 +178,12 @@ export default SelectKitComponent.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!isEmpty(this.filter) && !isEmpty(this.collectionComputedContent)) {
|
||||||
!isEmpty(this.filter) &&
|
|
||||||
!isEmpty(this.collectionComputedContent)
|
|
||||||
) {
|
|
||||||
this.highlight(this.get("collectionComputedContent.firstObject"));
|
this.highlight(this.get("collectionComputedContent.firstObject"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!this.isAsync && this.hasSelection && isEmpty(this.filter)) {
|
||||||
!this.isAsync &&
|
|
||||||
this.hasSelection &&
|
|
||||||
isEmpty(this.filter)
|
|
||||||
) {
|
|
||||||
this.highlight(get(makeArray(this.selection), "firstObject"));
|
this.highlight(get(makeArray(this.selection), "firstObject"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -235,10 +226,7 @@ export default SelectKitComponent.extend({
|
||||||
!computedContentItem ||
|
!computedContentItem ||
|
||||||
computedContentItem.__sk_row_type === "noneRow"
|
computedContentItem.__sk_row_type === "noneRow"
|
||||||
) {
|
) {
|
||||||
applyOnSelectNonePluginApiCallbacks(
|
applyOnSelectNonePluginApiCallbacks(this.pluginApiIdentifiers, this);
|
||||||
this.pluginApiIdentifiers,
|
|
||||||
this
|
|
||||||
);
|
|
||||||
this._boundaryActionHandler("onSelectNone");
|
this._boundaryActionHandler("onSelectNone");
|
||||||
this._boundaryActionHandler("onSelectAny", computedContentItem);
|
this._boundaryActionHandler("onSelectAny", computedContentItem);
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
|
|
|
@ -105,9 +105,10 @@ export default MultiSelectComponent.extend(TagsMixin, {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (selectedTags.length || this.blacklist.length) {
|
if (selectedTags.length || this.blacklist.length) {
|
||||||
data.selected_tags = _.uniq(
|
data.selected_tags = _.uniq(selectedTags.concat(this.blacklist)).slice(
|
||||||
selectedTags.concat(this.blacklist)
|
0,
|
||||||
).slice(0, 100);
|
100
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.everyTag) data.filterForInput = true;
|
if (!this.everyTag) data.filterForInput = true;
|
||||||
|
|
|
@ -180,10 +180,7 @@ export default Ember.Mixin.create({
|
||||||
const offsetBottom = this.element.getBoundingClientRect().bottom;
|
const offsetBottom = this.element.getBoundingClientRect().bottom;
|
||||||
const windowWidth = $(window).width();
|
const windowWidth = $(window).width();
|
||||||
|
|
||||||
if (
|
if (this.fullWidthOnMobile && (this.site && this.site.isMobileDevice)) {
|
||||||
this.fullWidthOnMobile &&
|
|
||||||
(this.site && this.site.isMobileDevice)
|
|
||||||
) {
|
|
||||||
const margin = 10;
|
const margin = 10;
|
||||||
const relativeLeft = this.$().offset().left - $(window).scrollLeft();
|
const relativeLeft = this.$().offset().left - $(window).scrollLeft();
|
||||||
options.left = margin - relativeLeft;
|
options.left = margin - relativeLeft;
|
||||||
|
@ -218,8 +215,7 @@ export default Ember.Mixin.create({
|
||||||
if (this._isRTL()) {
|
if (this._isRTL()) {
|
||||||
options.right = this.horizontalOffset;
|
options.right = this.horizontalOffset;
|
||||||
} else {
|
} else {
|
||||||
options.left =
|
options.left = -bodyWidth + elementWidth - this.horizontalOffset;
|
||||||
-bodyWidth + elementWidth - this.horizontalOffset;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$()
|
this.$()
|
||||||
|
@ -227,16 +223,14 @@ export default Ember.Mixin.create({
|
||||||
.removeClass("is-left-aligned");
|
.removeClass("is-left-aligned");
|
||||||
|
|
||||||
if (this._isRTL()) {
|
if (this._isRTL()) {
|
||||||
options.right =
|
options.right = -bodyWidth + elementWidth - this.horizontalOffset;
|
||||||
-bodyWidth + elementWidth - this.horizontalOffset;
|
|
||||||
} else {
|
} else {
|
||||||
options.left = this.horizontalOffset;
|
options.left = this.horizontalOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullHeight =
|
const fullHeight = this.verticalOffset + bodyHeight + componentHeight;
|
||||||
this.verticalOffset + bodyHeight + componentHeight;
|
|
||||||
const hasBelowSpace = $(window).height() - offsetBottom - fullHeight >= -1;
|
const hasBelowSpace = $(window).height() - offsetBottom - fullHeight >= -1;
|
||||||
const hasAboveSpace = offsetTop - fullHeight - discourseHeaderHeight >= -1;
|
const hasAboveSpace = offsetTop - fullHeight - discourseHeaderHeight >= -1;
|
||||||
const headerHeight = this._computedStyle(this.$header()[0], "height");
|
const headerHeight = this._computedStyle(this.$header()[0], "height");
|
||||||
|
|
|
@ -55,11 +55,7 @@ export default Ember.Mixin.create({
|
||||||
},
|
},
|
||||||
|
|
||||||
_castInteger(value) {
|
_castInteger(value) {
|
||||||
if (
|
if (this.castInteger && Ember.isPresent(value) && this._isNumeric(value)) {
|
||||||
this.castInteger &&
|
|
||||||
Ember.isPresent(value) &&
|
|
||||||
this._isNumeric(value)
|
|
||||||
) {
|
|
||||||
return parseInt(value, 10);
|
return parseInt(value, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,7 @@ export function createPreviewComponent(width, height, obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const colors = this.wizard.getCurrentColors(
|
const colors = this.wizard.getCurrentColors(this.colorsId);
|
||||||
this.colorsId
|
|
||||||
);
|
|
||||||
if (!colors) {
|
if (!colors) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,8 @@ componentTest("with value", {
|
||||||
template: "{{category-chooser value=2}}",
|
template: "{{category-chooser value=2}}",
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), 2);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "feature");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"feature"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,11 +22,7 @@ componentTest("with excludeCategoryId", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.notOk(
|
assert.notOk(this.subject.rowByValue(2).exists());
|
||||||
this.subject
|
|
||||||
.rowByValue(2)
|
|
||||||
.exists()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -47,29 +33,15 @@ componentTest("with scopedCategoryId", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(0).title(),
|
||||||
.rowByIndex(0)
|
|
||||||
.title(),
|
|
||||||
"Discussion about features or potential features of Discourse: how they work, why they work, etc."
|
"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(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).title(),
|
||||||
.rowByIndex(0)
|
|
||||||
.value(),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
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"
|
"My idea here is to have mini specs for features we would like built but have no bandwidth to build"
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByIndex(1).value(), 26);
|
||||||
this.subject
|
|
||||||
.rowByIndex(1)
|
|
||||||
.value(),
|
|
||||||
26
|
|
||||||
);
|
|
||||||
assert.equal(this.subject.rows().length, 2);
|
assert.equal(this.subject.rows().length, 2);
|
||||||
|
|
||||||
await this.subject.fillInFilter("dev");
|
await this.subject.fillInFilter("dev");
|
||||||
|
@ -86,18 +58,8 @@ componentTest("with allowUncategorized=null", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), null);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "category");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"category"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -109,18 +71,8 @@ componentTest("with allowUncategorized=null rootNone=true", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), null);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "category");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"category"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -134,18 +86,8 @@ componentTest("with disallowed uncategorized, rootNone and rootNoneLabel", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), null);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "category");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"category"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,18 +99,8 @@ componentTest("with allowed uncategorized", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), null);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "uncategorized");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"uncategorized"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -180,18 +112,8 @@ componentTest("with allowed uncategorized and rootNone", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), null);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "(no category)");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"(no category)"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -205,17 +127,7 @@ componentTest("with allowed uncategorized rootNone and rootNoneLabel", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), null);
|
||||||
this.subject
|
assert.equal(this.subject.header().title(), "root none label");
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"root none label"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,25 +25,19 @@ componentTest("subcatgories - no selection", {
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().title(),
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
I18n.t("categories.all_subcategories")
|
I18n.t("categories.all_subcategories")
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(0).name(),
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
I18n.t("categories.no_subcategory")
|
I18n.t("categories.no_subcategory")
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).name(),
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
this.get("childCategories.firstObject.name")
|
this.get("childCategories.firstObject.name")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,25 +61,19 @@ componentTest("subcatgories - selection", {
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().title(),
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
this.get("childCategories.firstObject.name")
|
this.get("childCategories.firstObject.name")
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(0).name(),
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
I18n.t("categories.all_subcategories")
|
I18n.t("categories.all_subcategories")
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).name(),
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
I18n.t("categories.no_subcategory")
|
I18n.t("categories.no_subcategory")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,9 @@ componentTest("default", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), 2);
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
this.subject
|
this.subject.rowByValue(2).exists(),
|
||||||
.rowByValue(2)
|
|
||||||
.exists(),
|
|
||||||
"selected categories are not in the list"
|
"selected categories are not in the list"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -43,15 +36,11 @@ componentTest("with blacklist", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
this.subject
|
this.subject.rowByValue(6).exists(),
|
||||||
.rowByValue(6)
|
|
||||||
.exists(),
|
|
||||||
"not blacklisted categories are in the list"
|
"not blacklisted categories are in the list"
|
||||||
);
|
);
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
this.subject
|
this.subject.rowByValue(8).exists(),
|
||||||
.rowByValue(8)
|
|
||||||
.exists(),
|
|
||||||
"blacklisted categories are not in the list"
|
"blacklisted categories are not in the list"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -70,9 +59,7 @@ componentTest("interactions", {
|
||||||
await this.subject.selectRowByValue(8);
|
await this.subject.selectRowByValue(8);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().value(),
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
"2,6,8",
|
"2,6,8",
|
||||||
"it adds the selected category"
|
"it adds the selected category"
|
||||||
);
|
);
|
||||||
|
@ -84,9 +71,7 @@ componentTest("interactions", {
|
||||||
await this.subject.keyboard("backspace");
|
await this.subject.keyboard("backspace");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().value(),
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
"2,6",
|
"2,6",
|
||||||
"it removes the last selected category"
|
"it removes the last selected category"
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,24 +15,9 @@ componentTest("default", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "hello");
|
||||||
this.subject
|
assert.equal(this.subject.rowByValue(1).name(), "hello");
|
||||||
.header()
|
assert.equal(this.subject.rowByValue(2).name(), "world");
|
||||||
.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) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByValue(0).name(), "hello");
|
||||||
this.subject
|
assert.equal(this.subject.rowByValue(1).name(), "world");
|
||||||
.rowByValue(0)
|
|
||||||
.name(),
|
|
||||||
"hello"
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.rowByValue(1)
|
|
||||||
.name(),
|
|
||||||
"world"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,18 +47,8 @@ componentTest("with nameProperty", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByValue(0).name(), "hello");
|
||||||
this.subject
|
assert.equal(this.subject.rowByValue(1).name(), "world");
|
||||||
.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) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByValue("evil").name(), "evil");
|
||||||
this.subject
|
assert.equal(this.subject.rowByValue("trout").name(), "trout");
|
||||||
.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) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.noneRow().name(), "none");
|
||||||
this.subject
|
assert.equal(this.subject.rowByValue("evil").name(), "evil");
|
||||||
.noneRow()
|
assert.equal(this.subject.rowByValue("trout").name(), "trout");
|
||||||
.name(),
|
assert.equal(this.subject.header().name(), "trout");
|
||||||
"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");
|
assert.equal(this.value, "trout");
|
||||||
|
|
||||||
await this.subject.selectNoneRow();
|
await this.subject.selectNoneRow();
|
||||||
|
@ -165,30 +100,10 @@ componentTest("with value and none as an object", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.noneRow().name(), "none");
|
||||||
this.subject
|
assert.equal(this.subject.rowByValue("evil").name(), "evil");
|
||||||
.noneRow()
|
assert.equal(this.subject.rowByValue("trout").name(), "trout");
|
||||||
.name(),
|
assert.equal(this.subject.header().name(), "evil");
|
||||||
"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");
|
assert.equal(this.value, "evil");
|
||||||
|
|
||||||
await this.subject.selectNoneRow();
|
await this.subject.selectNoneRow();
|
||||||
|
@ -209,12 +124,7 @@ componentTest("with no value and none as an object", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "none");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"none"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -230,12 +140,7 @@ componentTest("with no value and none string", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "none");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"none"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -250,9 +155,7 @@ componentTest("with no value and no none", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().name(),
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"evil",
|
"evil",
|
||||||
"it sets the first row as value"
|
"it sets the first row as value"
|
||||||
);
|
);
|
||||||
|
@ -270,9 +173,7 @@ componentTest("with empty string as value", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().name(),
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"evil",
|
"evil",
|
||||||
"it sets the first row as value"
|
"it sets the first row as value"
|
||||||
);
|
);
|
||||||
|
@ -292,9 +193,7 @@ componentTest("with noneLabel", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().name(),
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"none",
|
"none",
|
||||||
"it displays noneLabel as the header name"
|
"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 fillIn(".insert-link input.link-text", "evil trout");
|
||||||
await click(".insert-link button.btn-primary");
|
await click(".insert-link button.btn-primary");
|
||||||
assert.equal(find(".insert-link.hidden").length, 1);
|
assert.equal(find(".insert-link.hidden").length, 1);
|
||||||
assert.equal(
|
assert.equal(this.value, "hello world.[evil trout](http://eviltrout.com)");
|
||||||
this.value,
|
|
||||||
"hello world.[evil trout](http://eviltrout.com)"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTest("advanced code", {
|
componentTest("advanced code", {
|
||||||
|
@ -347,10 +344,7 @@ third line`
|
||||||
textarea.selectionEnd = 10;
|
textarea.selectionEnd = 10;
|
||||||
|
|
||||||
await click("button.code");
|
await click("button.code");
|
||||||
assert.equal(
|
assert.equal(this.value, "first `line`\n\nsecond line\n\nthird line");
|
||||||
this.value,
|
|
||||||
"first `line`\n\nsecond line\n\nthird line"
|
|
||||||
);
|
|
||||||
assert.equal(textarea.selectionStart, 7);
|
assert.equal(textarea.selectionStart, 7);
|
||||||
assert.equal(textarea.selectionEnd, 11);
|
assert.equal(textarea.selectionEnd, 11);
|
||||||
|
|
||||||
|
@ -363,10 +357,7 @@ third line`
|
||||||
textarea.selectionEnd = 23;
|
textarea.selectionEnd = 23;
|
||||||
|
|
||||||
await click("button.code");
|
await click("button.code");
|
||||||
assert.equal(
|
assert.equal(this.value, " first line\n\n second line\n\nthird line");
|
||||||
this.value,
|
|
||||||
" first line\n\n second line\n\nthird line"
|
|
||||||
);
|
|
||||||
assert.equal(textarea.selectionStart, 0);
|
assert.equal(textarea.selectionStart, 0);
|
||||||
assert.equal(textarea.selectionEnd, 31);
|
assert.equal(textarea.selectionEnd, 31);
|
||||||
|
|
||||||
|
|
|
@ -43,17 +43,13 @@ componentTest("default", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(0).name(),
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
"bianca",
|
"bianca",
|
||||||
"it has the correct tag"
|
"it has the correct tag"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).name(),
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
"régis",
|
"régis",
|
||||||
"it has the correct tag"
|
"it has the correct tag"
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,12 +18,7 @@ componentTest("with objects and values", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().value(), "1,2");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
"1,2"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -61,24 +56,16 @@ componentTest("interactions", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().name(),
|
||||||
.highlightedRow()
|
|
||||||
.name(),
|
|
||||||
"robin",
|
"robin",
|
||||||
"it highlights the first content row"
|
"it highlights the first content row"
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.set("none", "test.none");
|
await this.set("none", "test.none");
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(this.subject.noneRow().exists());
|
||||||
this.subject
|
|
||||||
.noneRow()
|
|
||||||
.exists()
|
|
||||||
);
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().name(),
|
||||||
.highlightedRow()
|
|
||||||
.name(),
|
|
||||||
"robin",
|
"robin",
|
||||||
"it highlights the first content row"
|
"it highlights the first content row"
|
||||||
);
|
);
|
||||||
|
@ -87,9 +74,7 @@ componentTest("interactions", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().name(),
|
||||||
.highlightedRow()
|
|
||||||
.name(),
|
|
||||||
"none",
|
"none",
|
||||||
"it highlights none row if no content"
|
"it highlights none row if no content"
|
||||||
);
|
);
|
||||||
|
@ -97,9 +82,7 @@ componentTest("interactions", {
|
||||||
await this.subject.fillInFilter("joffrey");
|
await this.subject.fillInFilter("joffrey");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().name(),
|
||||||
.highlightedRow()
|
|
||||||
.name(),
|
|
||||||
"joffrey",
|
"joffrey",
|
||||||
"it highlights create row when filling filter"
|
"it highlights create row when filling filter"
|
||||||
);
|
);
|
||||||
|
@ -107,9 +90,7 @@ componentTest("interactions", {
|
||||||
await this.subject.keyboard("enter");
|
await this.subject.keyboard("enter");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().name(),
|
||||||
.highlightedRow()
|
|
||||||
.name(),
|
|
||||||
"none",
|
"none",
|
||||||
"it highlights none row after creating content and no content left"
|
"it highlights none row after creating content and no content left"
|
||||||
);
|
);
|
||||||
|
@ -140,9 +121,7 @@ componentTest("interactions", {
|
||||||
"it removes the previous highlighted selected content"
|
"it removes the previous highlighted selected content"
|
||||||
);
|
);
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
this.subject
|
this.subject.rowByValue("joffrey").exists(),
|
||||||
.rowByValue("joffrey")
|
|
||||||
.exists(),
|
|
||||||
"generated content shouldn’t appear in content when removed"
|
"generated content shouldn’t appear in content when removed"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -191,12 +170,7 @@ componentTest("with limitMatches", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.el().find(".select-kit-row").length, 2);
|
||||||
this.subject
|
|
||||||
.el()
|
|
||||||
.find(".select-kit-row").length,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -210,19 +184,11 @@ componentTest("with minimum", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.validationMessage(), "Select at least 1 item.");
|
||||||
this.subject.validationMessage(),
|
|
||||||
"Select at least 1 item."
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.subject.selectRowByValue("sam");
|
await this.subject.selectRowByValue("sam");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().label(), "sam");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.label(),
|
|
||||||
"sam"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -242,12 +208,7 @@ componentTest("with minimumLabel", {
|
||||||
|
|
||||||
await this.subject.selectRowByValue("jeff");
|
await this.subject.selectRowByValue("jeff");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().label(), "jeff");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.label(),
|
|
||||||
"jeff"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,20 +27,10 @@ componentTest("updating the content refreshes the list", {
|
||||||
},
|
},
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "pinned");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"pinned"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.set("pinned", false);
|
await this.set("pinned", false);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "unpinned");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"unpinned"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,21 +19,11 @@ componentTest("updating the content refreshes the list", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByValue(1).name(), "BEFORE");
|
||||||
this.subject
|
|
||||||
.rowByValue(1)
|
|
||||||
.name(),
|
|
||||||
"BEFORE"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.set("content", [{ id: 1, name: "AFTER" }]);
|
await this.set("content", [{ id: 1, name: "AFTER" }]);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByValue(1).name(), "AFTER");
|
||||||
this.subject
|
|
||||||
.rowByValue(1)
|
|
||||||
.name(),
|
|
||||||
"AFTER"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -49,9 +39,7 @@ componentTest("accepts a value by reference", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.selectedRow().name(),
|
||||||
.selectedRow()
|
|
||||||
.name(),
|
|
||||||
"robin",
|
"robin",
|
||||||
"it highlights the row corresponding to the value"
|
"it highlights the row corresponding to the value"
|
||||||
);
|
);
|
||||||
|
@ -67,9 +55,7 @@ componentTest("no default icon", {
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().icon().length,
|
||||||
.header()
|
|
||||||
.icon().length,
|
|
||||||
0,
|
0,
|
||||||
"it doesn’t have an icon if not specified"
|
"it doesn’t have an icon if not specified"
|
||||||
);
|
);
|
||||||
|
@ -82,14 +68,7 @@ componentTest("default search icon", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(exists(this.subject.filter().icon()), "it has an icon");
|
||||||
exists(
|
|
||||||
this.subject
|
|
||||||
.filter()
|
|
||||||
.icon()
|
|
||||||
),
|
|
||||||
"it has an icon"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,14 +78,7 @@ componentTest("with no search icon", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.notOk(
|
assert.notOk(exists(this.subject.filter().icon()), "it has no icon");
|
||||||
exists(
|
|
||||||
this.subject
|
|
||||||
.filter()
|
|
||||||
.icon()
|
|
||||||
),
|
|
||||||
"it has no icon"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -151,12 +123,7 @@ componentTest("accepts custom value/name keys", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.selectedRow().name(), "robin");
|
||||||
this.subject
|
|
||||||
.selectedRow()
|
|
||||||
.name(),
|
|
||||||
"robin"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -186,19 +153,12 @@ componentTest("dynamic headerText", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "robin");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"robin"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.subject.selectRowByValue(2);
|
await this.subject.selectRowByValue(2);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.header().name(),
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"regis",
|
"regis",
|
||||||
"it changes header text"
|
"it changes header text"
|
||||||
);
|
);
|
||||||
|
@ -243,19 +203,12 @@ componentTest("supports converting select value to integer", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.selectedRow().name(), "régis");
|
||||||
this.subject
|
|
||||||
.selectedRow()
|
|
||||||
.name(),
|
|
||||||
"régis"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.set("value", 1);
|
await this.set("value", 1);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.selectedRow().name(),
|
||||||
.selectedRow()
|
|
||||||
.name(),
|
|
||||||
"robin",
|
"robin",
|
||||||
"it works with dynamic content"
|
"it works with dynamic content"
|
||||||
);
|
);
|
||||||
|
@ -276,19 +229,12 @@ componentTest("supports converting string as boolean to boolean", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.selectedRow().name(), "ASC");
|
||||||
this.subject
|
|
||||||
.selectedRow()
|
|
||||||
.name(),
|
|
||||||
"ASC"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.set("value", false);
|
await this.set("value", false);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.selectedRow().name(),
|
||||||
.selectedRow()
|
|
||||||
.name(),
|
|
||||||
"DESC",
|
"DESC",
|
||||||
"it works with dynamic content"
|
"it works with dynamic content"
|
||||||
);
|
);
|
||||||
|
@ -308,9 +254,7 @@ componentTest("supports keyboard events", {
|
||||||
await this.subject.keyboard("down");
|
await this.subject.keyboard("down");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().title(),
|
||||||
.highlightedRow()
|
|
||||||
.title(),
|
|
||||||
"regis",
|
"regis",
|
||||||
"the next row is highlighted"
|
"the next row is highlighted"
|
||||||
);
|
);
|
||||||
|
@ -318,9 +262,7 @@ componentTest("supports keyboard events", {
|
||||||
await this.subject.keyboard("down");
|
await this.subject.keyboard("down");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().title(),
|
||||||
.highlightedRow()
|
|
||||||
.title(),
|
|
||||||
"robin",
|
"robin",
|
||||||
"it returns to the first row"
|
"it returns to the first row"
|
||||||
);
|
);
|
||||||
|
@ -328,9 +270,7 @@ componentTest("supports keyboard events", {
|
||||||
await this.subject.keyboard("up");
|
await this.subject.keyboard("up");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.highlightedRow().title(),
|
||||||
.highlightedRow()
|
|
||||||
.title(),
|
|
||||||
"regis",
|
"regis",
|
||||||
"it highlights the last row"
|
"it highlights the last row"
|
||||||
);
|
);
|
||||||
|
@ -338,9 +278,7 @@ componentTest("supports keyboard events", {
|
||||||
await this.subject.keyboard("enter");
|
await this.subject.keyboard("enter");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.selectedRow().title(),
|
||||||
.selectedRow()
|
|
||||||
.title(),
|
|
||||||
"regis",
|
"regis",
|
||||||
"it selects the row when pressing enter"
|
"it selects the row when pressing enter"
|
||||||
);
|
);
|
||||||
|
@ -352,10 +290,7 @@ componentTest("supports keyboard events", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
await this.subject.keyboard("escape");
|
await this.subject.keyboard("escape");
|
||||||
|
|
||||||
assert.notOk(
|
assert.notOk(this.subject.isExpanded(), "it collapses the select box");
|
||||||
this.subject.isExpanded(),
|
|
||||||
"it collapses the select box"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
await this.subject.fillInFilter("regis");
|
await this.subject.fillInFilter("regis");
|
||||||
|
@ -381,11 +316,7 @@ componentTest("with allowInitialValueMutation", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.value, "1", "it mutates the value on initial rendering");
|
||||||
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();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(this.subject.rows().length, 2);
|
assert.equal(this.subject.rows().length, 2);
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByIndex(1).name(), "regis");
|
||||||
this.subject
|
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
"regis"
|
|
||||||
);
|
|
||||||
|
|
||||||
clearCallbacks();
|
clearCallbacks();
|
||||||
}
|
}
|
||||||
|
@ -439,12 +365,7 @@ componentTest("support modifying content through plugin api", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(this.subject.rows().length, 3);
|
assert.equal(this.subject.rows().length, 3);
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByIndex(1).name(), "sam");
|
||||||
this.subject
|
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
"sam"
|
|
||||||
);
|
|
||||||
|
|
||||||
clearCallbacks();
|
clearCallbacks();
|
||||||
}
|
}
|
||||||
|
@ -467,12 +388,7 @@ componentTest("support prepending content through plugin api", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(this.subject.rows().length, 2);
|
assert.equal(this.subject.rows().length, 2);
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByIndex(0).name(), "regis");
|
||||||
this.subject
|
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
"regis"
|
|
||||||
);
|
|
||||||
|
|
||||||
clearCallbacks();
|
clearCallbacks();
|
||||||
}
|
}
|
||||||
|
@ -551,21 +467,11 @@ componentTest("with nameChanges", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "robin");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"robin"
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.set("robin.name", "robin2");
|
await this.set("robin.name", "robin2");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "robin2");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"robin2"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -579,18 +485,8 @@ componentTest("with null value", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().name(), "robin");
|
||||||
this.subject
|
assert.equal(this.subject.header().value(), undefined);
|
||||||
.header()
|
|
||||||
.name(),
|
|
||||||
"robin"
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
undefined
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -616,12 +512,7 @@ componentTest("with title", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().title(), "My title");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"My title"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -642,12 +533,7 @@ componentTest("support modifying header computed content through plugin api", {
|
||||||
},
|
},
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
assert.equal(
|
assert.equal(this.subject.header().title(), "Not so evil");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"Not so evil"
|
|
||||||
);
|
|
||||||
|
|
||||||
clearCallbacks();
|
clearCallbacks();
|
||||||
}
|
}
|
||||||
|
@ -663,12 +549,7 @@ componentTest("with limitMatches", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.el().find(".select-kit-row").length, 2);
|
||||||
this.subject
|
|
||||||
.el()
|
|
||||||
.find(".select-kit-row").length,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -683,19 +564,11 @@ componentTest("with minimum", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.validationMessage(), "Select at least 1 item.");
|
||||||
this.subject.validationMessage(),
|
|
||||||
"Select at least 1 item."
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.subject.selectRowByValue("sam");
|
await this.subject.selectRowByValue("sam");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().label(), "sam");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.label(),
|
|
||||||
"sam"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -715,12 +588,7 @@ componentTest("with minimumLabel", {
|
||||||
|
|
||||||
await this.subject.selectRowByValue("jeff");
|
await this.subject.selectRowByValue("jeff");
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().label(), "jeff");
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.label(),
|
|
||||||
"jeff"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -736,12 +604,7 @@ componentTest("with accents in filter", {
|
||||||
await this.subject.fillInFilter("jéff");
|
await this.subject.fillInFilter("jéff");
|
||||||
|
|
||||||
assert.equal(this.subject.rows().length, 1);
|
assert.equal(this.subject.rows().length, 1);
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByIndex(0).name(), "jeff");
|
||||||
this.subject
|
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
"jeff"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -757,12 +620,7 @@ componentTest("with accents in content", {
|
||||||
await this.subject.fillInFilter("jeff");
|
await this.subject.fillInFilter("jeff");
|
||||||
|
|
||||||
assert.equal(this.subject.rows().length, 1);
|
assert.equal(this.subject.rows().length, 1);
|
||||||
assert.equal(
|
assert.equal(this.subject.rowByIndex(0).name(), "jéff");
|
||||||
this.subject
|
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
"jéff"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -771,15 +629,9 @@ componentTest("with no content and allowAny", {
|
||||||
|
|
||||||
skip: true,
|
skip: true,
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await click(
|
await click(this.subject.header().el());
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.el()
|
|
||||||
);
|
|
||||||
|
|
||||||
const $filter = this.subject
|
const $filter = this.subject.filter().el();
|
||||||
.filter()
|
|
||||||
.el();
|
|
||||||
|
|
||||||
assert.ok($filter.hasClass("is-focused"));
|
assert.ok($filter.hasClass("is-focused"));
|
||||||
assert.ok(!$filter.hasClass("is-hidden"));
|
assert.ok(!$filter.hasClass("is-hidden"));
|
||||||
|
|
|
@ -41,35 +41,27 @@ componentTest("default", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).name(),
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
"jeff",
|
"jeff",
|
||||||
"it has the correct tag"
|
"it has the correct tag"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(2).name(),
|
||||||
.rowByIndex(2)
|
|
||||||
.name(),
|
|
||||||
"neil",
|
"neil",
|
||||||
"it has the correct tag"
|
"it has the correct tag"
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.subject.fillInFilter("rég");
|
await this.subject.fillInFilter("rég");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(0).name(),
|
||||||
.rowByIndex(0)
|
|
||||||
.name(),
|
|
||||||
"régis",
|
"régis",
|
||||||
"it displays the searched tag"
|
"it displays the searched tag"
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.subject.fillInFilter("");
|
await this.subject.fillInFilter("");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).name(),
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
"jeff",
|
"jeff",
|
||||||
"it returns top tags for an empty search"
|
"it returns top tags for an empty search"
|
||||||
);
|
);
|
||||||
|
@ -96,9 +88,7 @@ componentTest("no tags", {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
this.subject
|
this.subject.rowByIndex(1).name(),
|
||||||
.rowByIndex(1)
|
|
||||||
.name(),
|
|
||||||
undefined,
|
undefined,
|
||||||
"it has no tags and doesn’t crash"
|
"it has no tags and doesn’t crash"
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,22 +24,10 @@ componentTest("default", {
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
await this.subject.expand();
|
await this.subject.expand();
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(this.subject.header().title(), "Topic Controls");
|
||||||
this.subject
|
assert.equal(this.subject.header().value(), null);
|
||||||
.header()
|
|
||||||
.title(),
|
|
||||||
"Topic Controls"
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
this.subject
|
|
||||||
.header()
|
|
||||||
.value(),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
this.subject
|
this.subject.selectedRow().exists(),
|
||||||
.selectedRow()
|
|
||||||
.exists(),
|
|
||||||
"it doesn’t preselect first row"
|
"it doesn’t preselect first row"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user