mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
DEV: uses find() helper instead of this.$() in js tests (#7062)
This commit is contained in:
@ -13,11 +13,11 @@ widgetTest("listing actions", {
|
||||
});
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".post-actions .post-action").length, 2);
|
||||
assert.equal(find(".post-actions .post-action").length, 2);
|
||||
|
||||
await click(".post-action:eq(0) .action-link a");
|
||||
assert.equal(
|
||||
this.$(".post-action:eq(0) img.avatar").length,
|
||||
find(".post-action:eq(0) img.avatar").length,
|
||||
1,
|
||||
"clicking it shows the user"
|
||||
);
|
||||
@ -37,7 +37,7 @@ widgetTest("undo", {
|
||||
this.set("undoPostAction", () => (this.undid = true));
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".post-actions .post-action").length, 1);
|
||||
assert.equal(find(".post-actions .post-action").length, 1);
|
||||
|
||||
await click(".action-link.undo");
|
||||
assert.ok(this.undid, "it triggered the action");
|
||||
@ -62,7 +62,7 @@ widgetTest("deferFlags", {
|
||||
this.on("deferPostActionFlags", () => (this.deferred = true));
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".post-actions .post-action").length, 1);
|
||||
assert.equal(find(".post-actions .post-action").length, 1);
|
||||
|
||||
await click(".action-link.defer-flags");
|
||||
assert.ok(this.deferred, "it triggered the action");
|
||||
@ -80,11 +80,11 @@ widgetTest("post deleted", {
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(
|
||||
this.$(".post-action .d-icon-far-trash-alt").length === 1,
|
||||
find(".post-action .d-icon-far-trash-alt").length === 1,
|
||||
"it has the deleted icon"
|
||||
);
|
||||
assert.ok(
|
||||
this.$(".avatar[title=eviltrout]").length === 1,
|
||||
find(".avatar[title=eviltrout]").length === 1,
|
||||
"it has the deleted by avatar"
|
||||
);
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ widgetTest("avatar flair with an icon", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".avatar-flair").length, "it has the tag");
|
||||
assert.ok(this.$("svg.d-icon-bars").length, "it has the svg icon");
|
||||
assert.ok(find(".avatar-flair").length, "it has the tag");
|
||||
assert.ok(find("svg.d-icon-bars").length, "it has the svg icon");
|
||||
assert.equal(
|
||||
this.$(".avatar-flair").attr("style"),
|
||||
find(".avatar-flair").attr("style"),
|
||||
"background-color: #CC0000; color: #FFFFFF; ",
|
||||
"it has styles"
|
||||
);
|
||||
@ -30,7 +30,7 @@ widgetTest("avatar flair with an image", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".avatar-flair").length, "it has the tag");
|
||||
assert.ok(this.$("svg").length === 0, "it does not have an svg icon");
|
||||
assert.ok(find(".avatar-flair").length, "it has the tag");
|
||||
assert.ok(find("svg").length === 0, "it does not have an svg icon");
|
||||
}
|
||||
});
|
||||
|
@ -11,11 +11,11 @@ widgetTest("icon only button", {
|
||||
|
||||
test(assert) {
|
||||
assert.ok(
|
||||
this.$("button.btn.btn-icon.no-text").length,
|
||||
find("button.btn.btn-icon.no-text").length,
|
||||
"it has all the classes"
|
||||
);
|
||||
assert.ok(
|
||||
this.$("button .d-icon.d-icon-far-smile").length,
|
||||
find("button .d-icon.d-icon-far-smile").length,
|
||||
"it has the icon"
|
||||
);
|
||||
}
|
||||
@ -30,11 +30,11 @@ widgetTest("icon and text button", {
|
||||
|
||||
test(assert) {
|
||||
assert.ok(
|
||||
this.$("button.btn.btn-icon-text").length,
|
||||
find("button.btn.btn-icon-text").length,
|
||||
"it has all the classes"
|
||||
);
|
||||
assert.ok(this.$("button .d-icon.d-icon-plus").length, "it has the icon");
|
||||
assert.ok(this.$("button span.d-button-label").length, "it has the label");
|
||||
assert.ok(find("button .d-icon.d-icon-plus").length, "it has the icon");
|
||||
assert.ok(find("button span.d-button-label").length, "it has the label");
|
||||
}
|
||||
});
|
||||
|
||||
@ -46,7 +46,7 @@ widgetTest("text only button", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("button.btn.btn-text").length, "it has all the classes");
|
||||
assert.ok(this.$("button span.d-button-label").length, "it has the label");
|
||||
assert.ok(find("button.btn.btn-text").length, "it has all the classes");
|
||||
assert.ok(find("button span.d-button-label").length, "it has the label");
|
||||
}
|
||||
});
|
||||
|
@ -17,8 +17,8 @@ widgetTest("prioritize faq", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".faq-priority").length);
|
||||
assert.ok(!this.$(".faq-link").length);
|
||||
assert.ok(find(".faq-priority").length);
|
||||
assert.ok(!find(".faq-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -31,8 +31,8 @@ widgetTest("prioritize faq - user has read", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".faq-priority").length);
|
||||
assert.ok(this.$(".faq-link").length);
|
||||
assert.ok(!find(".faq-priority").length);
|
||||
assert.ok(find(".faq-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -44,7 +44,7 @@ widgetTest("staff menu - not staff", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".admin-link").length);
|
||||
assert.ok(!find(".admin-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -59,10 +59,10 @@ widgetTest("staff menu", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".admin-link").length);
|
||||
assert.ok(this.$(".flagged-posts-link").length);
|
||||
assert.equal(this.$(".flagged-posts").text(), "3");
|
||||
assert.ok(!this.$(".settings-link").length);
|
||||
assert.ok(find(".admin-link").length);
|
||||
assert.ok(find(".flagged-posts-link").length);
|
||||
assert.equal(find(".flagged-posts").text(), "3");
|
||||
assert.ok(!find(".settings-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -74,7 +74,7 @@ widgetTest("staff menu - admin", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".settings-link").length);
|
||||
assert.ok(find(".settings-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -90,8 +90,8 @@ widgetTest("queued posts", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".queued-posts-link").length);
|
||||
assert.equal(this.$(".queued-posts").text(), "5");
|
||||
assert.ok(find(".queued-posts-link").length);
|
||||
assert.equal(find(".queued-posts").text(), "5");
|
||||
}
|
||||
});
|
||||
|
||||
@ -103,7 +103,7 @@ widgetTest("queued posts - disabled", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".queued-posts-link").length);
|
||||
assert.ok(!find(".queued-posts-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -111,8 +111,8 @@ widgetTest("logged in links", {
|
||||
template: '{{mount-widget widget="hamburger-menu"}}',
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".new-topics-link").length);
|
||||
assert.ok(this.$(".unread-topics-link").length);
|
||||
assert.ok(find(".new-topics-link").length);
|
||||
assert.ok(find(".unread-topics-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -121,13 +121,13 @@ widgetTest("general links", {
|
||||
anonymous: true,
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("li[class='']").length === 0);
|
||||
assert.ok(this.$(".latest-topics-link").length);
|
||||
assert.ok(!this.$(".new-topics-link").length);
|
||||
assert.ok(!this.$(".unread-topics-link").length);
|
||||
assert.ok(this.$(".top-topics-link").length);
|
||||
assert.ok(this.$(".badge-link").length);
|
||||
assert.ok(this.$(".category-link").length > 0);
|
||||
assert.ok(find("li[class='']").length === 0);
|
||||
assert.ok(find(".latest-topics-link").length);
|
||||
assert.ok(!find(".new-topics-link").length);
|
||||
assert.ok(!find(".unread-topics-link").length);
|
||||
assert.ok(find(".top-topics-link").length);
|
||||
assert.ok(find(".badge-link").length);
|
||||
assert.ok(find(".category-link").length > 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -213,7 +213,7 @@ widgetTest("badges link - disabled", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".badge-link").length);
|
||||
assert.ok(!find(".badge-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -221,7 +221,7 @@ widgetTest("badges link", {
|
||||
template: '{{mount-widget widget="hamburger-menu"}}',
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".badge-link").length);
|
||||
assert.ok(find(".badge-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -229,7 +229,7 @@ widgetTest("user directory link", {
|
||||
template: '{{mount-widget widget="hamburger-menu"}}',
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".user-directory-link").length);
|
||||
assert.ok(find(".user-directory-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -241,7 +241,7 @@ widgetTest("user directory link - disabled", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".user-directory-link").length);
|
||||
assert.ok(!find(".user-directory-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -249,7 +249,7 @@ widgetTest("general links", {
|
||||
template: '{{mount-widget widget="hamburger-menu"}}',
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".about-link").length);
|
||||
assert.ok(this.$(".keyboard-shortcuts-link").length);
|
||||
assert.ok(find(".about-link").length);
|
||||
assert.ok(find(".keyboard-shortcuts-link").length);
|
||||
}
|
||||
});
|
||||
|
@ -5,8 +5,8 @@ moduleForWidget("header");
|
||||
widgetTest("rendering basics", {
|
||||
template: '{{mount-widget widget="header"}}',
|
||||
test(assert) {
|
||||
assert.ok(this.$("header.d-header").length);
|
||||
assert.ok(this.$("#site-logo").length);
|
||||
assert.ok(find("header.d-header").length);
|
||||
assert.ok(find("#site-logo").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -22,8 +22,8 @@ widgetTest("sign up / login buttons", {
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(this.$("button.sign-up-button").length);
|
||||
assert.ok(this.$("button.login-button").length);
|
||||
assert.ok(find("button.sign-up-button").length);
|
||||
assert.ok(find("button.login-button").length);
|
||||
|
||||
await click("button.sign-up-button");
|
||||
assert.ok(this.signupShown);
|
||||
|
@ -17,11 +17,11 @@ widgetTest("basics", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".title").length === 1);
|
||||
assert.ok(find(".title").length === 1);
|
||||
|
||||
assert.ok(this.$("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(this.$("#site-logo").attr("src"), bigLogo);
|
||||
assert.equal(this.$("#site-logo").attr("alt"), title);
|
||||
assert.ok(find("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(find("#site-logo").attr("src"), bigLogo);
|
||||
assert.equal(find("#site-logo").attr("alt"), title);
|
||||
}
|
||||
});
|
||||
|
||||
@ -35,9 +35,9 @@ widgetTest("basics - minimized", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("img.logo-small").length === 1);
|
||||
assert.equal(this.$("img.logo-small").attr("src"), smallLogo);
|
||||
assert.equal(this.$("img.logo-small").attr("alt"), title);
|
||||
assert.ok(find("img.logo-small").length === 1);
|
||||
assert.equal(find("img.logo-small").attr("src"), smallLogo);
|
||||
assert.equal(find("img.logo-small").attr("alt"), title);
|
||||
}
|
||||
});
|
||||
|
||||
@ -51,8 +51,8 @@ widgetTest("no logo", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("h1#site-text-logo.text-logo").length === 1);
|
||||
assert.equal(this.$("#site-text-logo").text(), title);
|
||||
assert.ok(find("h1#site-text-logo.text-logo").length === 1);
|
||||
assert.equal(find("#site-text-logo").text(), title);
|
||||
}
|
||||
});
|
||||
|
||||
@ -66,7 +66,7 @@ widgetTest("no logo - minimized", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".d-icon-home").length === 1);
|
||||
assert.ok(find(".d-icon-home").length === 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -79,8 +79,8 @@ widgetTest("mobile logo", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(this.$("#site-logo").attr("src"), mobileLogo);
|
||||
assert.ok(find("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(find("#site-logo").attr("src"), mobileLogo);
|
||||
}
|
||||
});
|
||||
|
||||
@ -92,8 +92,8 @@ widgetTest("mobile without logo", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(this.$("#site-logo").attr("src"), bigLogo);
|
||||
assert.ok(find("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(find("#site-logo").attr("src"), bigLogo);
|
||||
}
|
||||
});
|
||||
|
||||
@ -108,9 +108,9 @@ widgetTest("basics, subfolder", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(this.$("#site-logo").attr("src"), `/forum${bigLogo}`);
|
||||
assert.equal(this.$("#site-logo").attr("alt"), title);
|
||||
assert.ok(find("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(find("#site-logo").attr("src"), `/forum${bigLogo}`);
|
||||
assert.equal(find("#site-logo").attr("alt"), title);
|
||||
}
|
||||
});
|
||||
|
||||
@ -125,9 +125,9 @@ widgetTest("basics, subfolder - minimized", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("img.logo-small").length === 1);
|
||||
assert.equal(this.$("img.logo-small").attr("src"), `/forum${smallLogo}`);
|
||||
assert.equal(this.$("img.logo-small").attr("alt"), title);
|
||||
assert.ok(find("img.logo-small").length === 1);
|
||||
assert.equal(find("img.logo-small").attr("src"), `/forum${smallLogo}`);
|
||||
assert.equal(find("img.logo-small").attr("alt"), title);
|
||||
}
|
||||
});
|
||||
|
||||
@ -141,7 +141,7 @@ widgetTest("mobile logo, subfolder", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(this.$("#site-logo").attr("src"), `/forum${mobileLogo}`);
|
||||
assert.ok(find("img#site-logo.logo-big").length === 1);
|
||||
assert.equal(find("#site-logo").attr("src"), `/forum${mobileLogo}`);
|
||||
}
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ widgetTest("duplicate links", {
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.$(".post-links a.track-link").length,
|
||||
find(".post-links a.track-link").length,
|
||||
1,
|
||||
"it hides the dupe link"
|
||||
);
|
||||
@ -47,8 +47,8 @@ widgetTest("collapsed links", {
|
||||
});
|
||||
},
|
||||
async test(assert) {
|
||||
assert.ok(this.$(".expand-links").length === 1, "collapsed by default");
|
||||
assert.ok(find(".expand-links").length === 1, "collapsed by default");
|
||||
await click("a.expand-links");
|
||||
assert.equal(this.$(".post-links a.track-link").length, 7);
|
||||
assert.equal(find(".post-links a.track-link").length, 7);
|
||||
}
|
||||
});
|
||||
|
@ -61,55 +61,55 @@ postStreamTest("basics", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$(".post-stream").length, 1);
|
||||
assert.equal(this.$(".topic-post").length, 6, "renders all posts");
|
||||
assert.equal(find(".post-stream").length, 1);
|
||||
assert.equal(find(".topic-post").length, 6, "renders all posts");
|
||||
|
||||
// look for special class bindings
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(0).topic-owner").length,
|
||||
find(".topic-post:eq(0).topic-owner").length,
|
||||
1,
|
||||
"it applies the topic owner class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(0).group-trout").length,
|
||||
find(".topic-post:eq(0).group-trout").length,
|
||||
1,
|
||||
"it applies the primary group class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(0).regular").length,
|
||||
find(".topic-post:eq(0).regular").length,
|
||||
1,
|
||||
"it applies the regular class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(1).moderator").length,
|
||||
find(".topic-post:eq(1).moderator").length,
|
||||
1,
|
||||
"it applies the moderator class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(2).post-hidden").length,
|
||||
find(".topic-post:eq(2).post-hidden").length,
|
||||
1,
|
||||
"it applies the hidden class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(3).whisper").length,
|
||||
find(".topic-post:eq(3).whisper").length,
|
||||
1,
|
||||
"it applies the whisper class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".topic-post:eq(4).wiki").length,
|
||||
find(".topic-post:eq(4).wiki").length,
|
||||
1,
|
||||
"it applies the wiki class"
|
||||
);
|
||||
|
||||
// it renders an article for the body with appropriate attributes
|
||||
assert.equal(this.$("article#post_2").length, 1);
|
||||
assert.equal(this.$("article[data-user-id=123]").length, 1);
|
||||
assert.equal(this.$("article[data-post-id=3]").length, 1);
|
||||
assert.equal(this.$("article#post_5.via-email").length, 1);
|
||||
assert.equal(this.$("article#post_6.is-auto-generated").length, 1);
|
||||
assert.equal(find("article#post_2").length, 1);
|
||||
assert.equal(find("article[data-user-id=123]").length, 1);
|
||||
assert.equal(find("article[data-post-id=3]").length, 1);
|
||||
assert.equal(find("article#post_5.via-email").length, 1);
|
||||
assert.equal(find("article#post_6.is-auto-generated").length, 1);
|
||||
|
||||
assert.equal(
|
||||
this.$("article:eq(0) .main-avatar").length,
|
||||
find("article:eq(0) .main-avatar").length,
|
||||
1,
|
||||
"renders the main avatar"
|
||||
);
|
||||
@ -131,12 +131,12 @@ postStreamTest("deleted posts", {
|
||||
|
||||
test(assert) {
|
||||
assert.equal(
|
||||
this.$(".topic-post.deleted").length,
|
||||
find(".topic-post.deleted").length,
|
||||
1,
|
||||
"it applies the deleted class"
|
||||
);
|
||||
assert.equal(
|
||||
this.$(".deleted-user-avatar").length,
|
||||
find(".deleted-user-avatar").length,
|
||||
1,
|
||||
"it has the trash avatar"
|
||||
);
|
||||
|
@ -8,11 +8,11 @@ widgetTest("basic elements", {
|
||||
this.set("args", { shareUrl: "/example", post_number: 1 });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".names").length, "includes poster name");
|
||||
assert.ok(find(".names").length, "includes poster name");
|
||||
|
||||
assert.ok(this.$("a.post-date").length, "includes post date");
|
||||
assert.ok(this.$("a.post-date[data-share-url]").length);
|
||||
assert.ok(this.$("a.post-date[data-post-number]").length);
|
||||
assert.ok(find("a.post-date").length, "includes post date");
|
||||
assert.ok(find("a.post-date[data-share-url]").length);
|
||||
assert.ok(find("a.post-date[data-post-number]").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -109,8 +109,8 @@ widgetTest("whisper", {
|
||||
this.set("args", { isWhisper: true });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".topic-post.whisper").length === 1);
|
||||
assert.ok(this.$(".post-info.whisper").length === 1);
|
||||
assert.ok(find(".topic-post.whisper").length === 1);
|
||||
assert.ok(find(".post-info.whisper").length === 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -129,18 +129,18 @@ widgetTest("like count button", {
|
||||
this.set("args", { likeCount: 1 });
|
||||
},
|
||||
async test(assert) {
|
||||
assert.ok(this.$("button.like-count").length === 1);
|
||||
assert.ok(this.$(".who-liked").length === 0);
|
||||
assert.ok(find("button.like-count").length === 1);
|
||||
assert.ok(find(".who-liked").length === 0);
|
||||
|
||||
// toggle it on
|
||||
await click("button.like-count");
|
||||
assert.ok(this.$(".who-liked").length === 1);
|
||||
assert.ok(this.$(".who-liked a.trigger-user-card").length === 1);
|
||||
assert.ok(find(".who-liked").length === 1);
|
||||
assert.ok(find(".who-liked a.trigger-user-card").length === 1);
|
||||
|
||||
// toggle it off
|
||||
await click("button.like-count");
|
||||
assert.ok(this.$(".who-liked").length === 0);
|
||||
assert.ok(this.$(".who-liked a.trigger-user-card").length === 0);
|
||||
assert.ok(find(".who-liked").length === 0);
|
||||
assert.ok(find(".who-liked a.trigger-user-card").length === 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -150,7 +150,7 @@ widgetTest(`like count with no likes`, {
|
||||
this.set("args", { likeCount: 0 });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$("button.like-count").length === 0);
|
||||
assert.ok(find("button.like-count").length === 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -161,7 +161,7 @@ widgetTest("share button", {
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(
|
||||
!!this.$(".actions button[data-share-url]").length,
|
||||
!!find(".actions button[data-share-url]").length,
|
||||
"it renders a share button"
|
||||
);
|
||||
}
|
||||
@ -179,18 +179,18 @@ widgetTest("liking", {
|
||||
});
|
||||
},
|
||||
async test(assert) {
|
||||
assert.ok(!!this.$(".actions button.like").length);
|
||||
assert.ok(this.$(".actions button.like-count").length === 0);
|
||||
assert.ok(!!find(".actions button.like").length);
|
||||
assert.ok(find(".actions button.like-count").length === 0);
|
||||
|
||||
await click(".actions button.like");
|
||||
assert.ok(!this.$(".actions button.like").length);
|
||||
assert.ok(!!this.$(".actions button.has-like").length);
|
||||
assert.ok(this.$(".actions button.like-count").length === 1);
|
||||
assert.ok(!find(".actions button.like").length);
|
||||
assert.ok(!!find(".actions button.has-like").length);
|
||||
assert.ok(find(".actions button.like-count").length === 1);
|
||||
|
||||
await click(".actions button.has-like");
|
||||
assert.ok(!!this.$(".actions button.like").length);
|
||||
assert.ok(!this.$(".actions button.has-like").length);
|
||||
assert.ok(this.$(".actions button.like-count").length === 0);
|
||||
assert.ok(!!find(".actions button.like").length);
|
||||
assert.ok(!find(".actions button.has-like").length);
|
||||
assert.ok(find(".actions button.like-count").length === 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -204,11 +204,11 @@ widgetTest("anon liking", {
|
||||
this.on("showLogin", () => (this.loginShown = true));
|
||||
},
|
||||
async test(assert) {
|
||||
assert.ok(!!this.$(".actions button.like").length);
|
||||
assert.ok(this.$(".actions button.like-count").length === 0);
|
||||
assert.ok(!!find(".actions button.like").length);
|
||||
assert.ok(find(".actions button.like-count").length === 0);
|
||||
|
||||
assert.equal(
|
||||
this.$("button.like").attr("title"),
|
||||
find("button.like").attr("title"),
|
||||
I18n.t("post.controls.like"),
|
||||
`shows the right button title for anonymous users`
|
||||
);
|
||||
@ -237,7 +237,7 @@ widgetTest(`edit button - can't edit`, {
|
||||
this.set("args", { canEdit: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.edit").length, 0, `button is not displayed`);
|
||||
assert.equal(find("button.edit").length, 0, `button is not displayed`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -273,7 +273,7 @@ widgetTest(`delete topic button - can't delete`, {
|
||||
this.set("args", { canDeleteTopic: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.delete").length, 0, `button is not displayed`);
|
||||
assert.equal(find("button.delete").length, 0, `button is not displayed`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -290,9 +290,9 @@ widgetTest(
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.delete").length, 1, `button is displayed`);
|
||||
assert.equal(find("button.delete").length, 1, `button is displayed`);
|
||||
assert.equal(
|
||||
this.$("button.delete").attr("title"),
|
||||
find("button.delete").attr("title"),
|
||||
I18n.t("post.controls.delete_topic_disallowed"),
|
||||
`shows the right button title for users without permissions`
|
||||
);
|
||||
@ -319,7 +319,7 @@ widgetTest(`recover topic button - can't recover`, {
|
||||
this.set("args", { canRecoverTopic: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.recover").length, 0, `button is not displayed`);
|
||||
assert.equal(find("button.recover").length, 0, `button is not displayed`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -342,7 +342,7 @@ widgetTest(`delete post button - can't delete`, {
|
||||
this.set("args", { canDelete: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.delete").length, 0, `button is not displayed`);
|
||||
assert.equal(find("button.delete").length, 0, `button is not displayed`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -365,7 +365,7 @@ widgetTest(`recover post button - can't recover`, {
|
||||
this.set("args", { canRecover: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.recover").length, 0, `button is not displayed`);
|
||||
assert.equal(find("button.recover").length, 0, `button is not displayed`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -377,7 +377,7 @@ widgetTest(`flagging`, {
|
||||
this.on("showFlags", () => (this.flagsShown = true));
|
||||
},
|
||||
async test(assert) {
|
||||
assert.ok(this.$("button.create-flag").length === 1);
|
||||
assert.ok(find("button.create-flag").length === 1);
|
||||
|
||||
await click("button.create-flag");
|
||||
assert.ok(this.flagsShown, "it triggered the action");
|
||||
@ -390,7 +390,7 @@ widgetTest(`flagging: can't flag`, {
|
||||
this.set("args", { canFlag: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$("button.create-flag").length === 0);
|
||||
assert.ok(find("button.create-flag").length === 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -400,7 +400,7 @@ widgetTest(`flagging: can't flag when post is hidden`, {
|
||||
this.set("args", { canFlag: true, hidden: true });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$("button.create-flag").length === 0);
|
||||
assert.ok(find("button.create-flag").length === 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -410,7 +410,7 @@ widgetTest(`read indicator`, {
|
||||
this.set("args", { read: true });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".read-state.read").length);
|
||||
assert.ok(find(".read-state.read").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -420,7 +420,7 @@ widgetTest(`unread indicator`, {
|
||||
this.set("args", { read: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".read-state").length);
|
||||
assert.ok(find(".read-state").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -434,9 +434,9 @@ widgetTest("reply directly above (supressed)", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("a.reply-to-tab").length, 0, "hides the tab");
|
||||
assert.equal(find("a.reply-to-tab").length, 0, "hides the tab");
|
||||
assert.equal(
|
||||
this.$(".avoid-tab").length,
|
||||
find(".avoid-tab").length,
|
||||
0,
|
||||
"doesn't have the avoid tab class"
|
||||
);
|
||||
@ -453,8 +453,8 @@ widgetTest("reply a few posts above (supressed)", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$("a.reply-to-tab").length, "shows the tab");
|
||||
assert.equal(this.$(".avoid-tab").length, 1, "has the avoid tab class");
|
||||
assert.ok(find("a.reply-to-tab").length, "shows the tab");
|
||||
assert.equal(find(".avoid-tab").length, 1, "has the avoid tab class");
|
||||
}
|
||||
});
|
||||
|
||||
@ -469,10 +469,10 @@ widgetTest("reply directly above", {
|
||||
this.siteSettings.suppress_reply_directly_above = false;
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".avoid-tab").length, 1, "has the avoid tab class");
|
||||
assert.equal(find(".avoid-tab").length, 1, "has the avoid tab class");
|
||||
await click("a.reply-to-tab");
|
||||
assert.equal(this.$("section.embedded-posts.top .cooked").length, 1);
|
||||
assert.equal(this.$("section.embedded-posts .d-icon-arrow-up").length, 1);
|
||||
assert.equal(find("section.embedded-posts.top .cooked").length, 1);
|
||||
assert.equal(find("section.embedded-posts .d-icon-arrow-up").length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -497,7 +497,7 @@ widgetTest("expand first post", {
|
||||
},
|
||||
async test(assert) {
|
||||
await click(".topic-body .expand-post");
|
||||
assert.equal(this.$(".expand-post").length, 0, "button is gone");
|
||||
assert.equal(find(".expand-post").length, 0, "button is gone");
|
||||
}
|
||||
});
|
||||
|
||||
@ -507,8 +507,8 @@ widgetTest("can't bookmark", {
|
||||
this.set("args", { canBookmark: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.bookmark").length, 0);
|
||||
assert.equal(this.$("button.bookmarked").length, 0);
|
||||
assert.equal(find("button.bookmark").length, 0);
|
||||
assert.equal(find("button.bookmarked").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -522,11 +522,11 @@ widgetTest("bookmark", {
|
||||
this.on("toggleBookmark", () => (args.bookmarked = true));
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".post-menu-area .bookmark").length, 1);
|
||||
assert.equal(this.$("button.bookmarked").length, 0);
|
||||
assert.equal(find(".post-menu-area .bookmark").length, 1);
|
||||
assert.equal(find("button.bookmarked").length, 0);
|
||||
|
||||
await click("button.bookmark");
|
||||
assert.equal(this.$("button.bookmarked").length, 1);
|
||||
assert.equal(find("button.bookmarked").length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -536,7 +536,7 @@ widgetTest("can't show admin menu when you can't manage", {
|
||||
this.set("args", { canManage: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".post-menu-area .show-post-admin-menu").length, 0);
|
||||
assert.equal(find(".post-menu-area .show-post-admin-menu").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -546,12 +546,12 @@ widgetTest("show admin menu", {
|
||||
this.set("args", { canManage: true });
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".post-admin-menu").length, 0);
|
||||
assert.equal(find(".post-admin-menu").length, 0);
|
||||
await click(".post-menu-area .show-post-admin-menu");
|
||||
assert.equal(this.$(".post-admin-menu").length, 1, "it shows the popup");
|
||||
assert.equal(find(".post-admin-menu").length, 1, "it shows the popup");
|
||||
await click(".post-menu-area");
|
||||
assert.equal(
|
||||
this.$(".post-admin-menu").length,
|
||||
find(".post-admin-menu").length,
|
||||
0,
|
||||
"clicking outside clears the popup"
|
||||
);
|
||||
@ -571,7 +571,7 @@ widgetTest("toggle moderator post", {
|
||||
await click(".post-admin-menu .toggle-post-type");
|
||||
|
||||
assert.ok(this.toggled);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
assert.equal(find(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
widgetTest("toggle moderator post", {
|
||||
@ -587,7 +587,7 @@ widgetTest("toggle moderator post", {
|
||||
await click(".post-admin-menu .toggle-post-type");
|
||||
|
||||
assert.ok(this.toggled);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
assert.equal(find(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
|
||||
@ -602,7 +602,7 @@ widgetTest("rebake post", {
|
||||
await click(".post-menu-area .show-post-admin-menu");
|
||||
await click(".post-admin-menu .rebuild-html");
|
||||
assert.ok(this.baked);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
assert.equal(find(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
|
||||
@ -617,7 +617,7 @@ widgetTest("unhide post", {
|
||||
await click(".post-menu-area .show-post-admin-menu");
|
||||
await click(".post-admin-menu .unhide-post");
|
||||
assert.ok(this.unhidden);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
assert.equal(find(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
|
||||
@ -633,7 +633,7 @@ widgetTest("change owner", {
|
||||
await click(".post-menu-area .show-post-admin-menu");
|
||||
await click(".post-admin-menu .change-owner");
|
||||
assert.ok(this.owned);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
assert.equal(find(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
|
||||
@ -656,7 +656,7 @@ widgetTest("reply - without permissions", {
|
||||
this.set("args", { canCreatePost: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".post-controls .create").length, 0);
|
||||
assert.equal(find(".post-controls .create").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -666,7 +666,7 @@ widgetTest("replies - no replies", {
|
||||
this.set("args", { replyCount: 0 });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.show-replies").length, 0);
|
||||
assert.equal(find("button.show-replies").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -677,7 +677,7 @@ widgetTest("replies - multiple replies", {
|
||||
this.set("args", { replyCount: 2, replyDirectlyBelow: true });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.show-replies").length, 1);
|
||||
assert.equal(find("button.show-replies").length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -688,7 +688,7 @@ widgetTest("replies - one below, suppressed", {
|
||||
this.set("args", { replyCount: 1, replyDirectlyBelow: true });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$("button.show-replies").length, 0);
|
||||
assert.equal(find("button.show-replies").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -700,8 +700,8 @@ widgetTest("replies - one below, not suppressed", {
|
||||
},
|
||||
async test(assert) {
|
||||
await click("button.show-replies");
|
||||
assert.equal(this.$("section.embedded-posts.bottom .cooked").length, 1);
|
||||
assert.equal(this.$("section.embedded-posts .d-icon-arrow-down").length, 1);
|
||||
assert.equal(find("section.embedded-posts.bottom .cooked").length, 1);
|
||||
assert.equal(find("section.embedded-posts .d-icon-arrow-down").length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -711,7 +711,7 @@ widgetTest("topic map not shown", {
|
||||
this.set("args", { showTopicMap: false });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".topic-map").length, 0);
|
||||
assert.equal(find(".topic-map").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -726,14 +726,14 @@ widgetTest("topic map - few posts", {
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
this.$("li.avatars a.poster").length,
|
||||
find("li.avatars a.poster").length,
|
||||
0,
|
||||
"shows no participants when collapsed"
|
||||
);
|
||||
|
||||
await click("nav.buttons button");
|
||||
assert.equal(
|
||||
this.$(".topic-map-expanded a.poster").length,
|
||||
find(".topic-map-expanded a.poster").length,
|
||||
2,
|
||||
"shows all when expanded"
|
||||
);
|
||||
@ -757,19 +757,19 @@ widgetTest("topic map - participants", {
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
this.$("li.avatars a.poster").length,
|
||||
find("li.avatars a.poster").length,
|
||||
3,
|
||||
"limits to three participants"
|
||||
);
|
||||
|
||||
await click("nav.buttons button");
|
||||
assert.equal(this.$("li.avatars a.poster").length, 0);
|
||||
assert.equal(find("li.avatars a.poster").length, 0);
|
||||
assert.equal(
|
||||
this.$(".topic-map-expanded a.poster").length,
|
||||
find(".topic-map-expanded a.poster").length,
|
||||
4,
|
||||
"shows all when expanded"
|
||||
);
|
||||
assert.equal(this.$("a.poster.toggled").length, 2, "two are toggled");
|
||||
assert.equal(find("a.poster.toggled").length, 2, "two are toggled");
|
||||
}
|
||||
});
|
||||
|
||||
@ -789,23 +789,23 @@ widgetTest("topic map - links", {
|
||||
});
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".topic-map").length, 1);
|
||||
assert.equal(this.$(".map.map-collapsed").length, 1);
|
||||
assert.equal(this.$(".topic-map-expanded").length, 0);
|
||||
assert.equal(find(".topic-map").length, 1);
|
||||
assert.equal(find(".map.map-collapsed").length, 1);
|
||||
assert.equal(find(".topic-map-expanded").length, 0);
|
||||
|
||||
await click("nav.buttons button");
|
||||
assert.equal(this.$(".map.map-collapsed").length, 0);
|
||||
assert.equal(this.$(".topic-map .d-icon-chevron-up").length, 1);
|
||||
assert.equal(this.$(".topic-map-expanded").length, 1);
|
||||
assert.equal(find(".map.map-collapsed").length, 0);
|
||||
assert.equal(find(".topic-map .d-icon-chevron-up").length, 1);
|
||||
assert.equal(find(".topic-map-expanded").length, 1);
|
||||
assert.equal(
|
||||
this.$(".topic-map-expanded .topic-link").length,
|
||||
find(".topic-map-expanded .topic-link").length,
|
||||
5,
|
||||
"it limits the links displayed"
|
||||
);
|
||||
|
||||
await click(".link-summary button");
|
||||
assert.equal(
|
||||
this.$(".topic-map-expanded .topic-link").length,
|
||||
find(".topic-map-expanded .topic-link").length,
|
||||
6,
|
||||
"all links now shown"
|
||||
);
|
||||
@ -818,7 +818,7 @@ widgetTest("topic map - no summary", {
|
||||
this.set("args", { showTopicMap: true });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".toggle-summary").length, 0);
|
||||
assert.equal(find(".toggle-summary").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -830,7 +830,7 @@ widgetTest("topic map - has summary", {
|
||||
this.on("toggleSummary", () => (this.summaryToggled = true));
|
||||
},
|
||||
async test(assert) {
|
||||
assert.equal(this.$(".toggle-summary").length, 1);
|
||||
assert.equal(find(".toggle-summary").length, 1);
|
||||
|
||||
await click(".toggle-summary button");
|
||||
assert.ok(this.summaryToggled);
|
||||
@ -848,7 +848,7 @@ widgetTest("pm map", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".private-message-map").length, 1);
|
||||
assert.equal(this.$(".private-message-map .user").length, 1);
|
||||
assert.equal(find(".private-message-map").length, 1);
|
||||
assert.equal(find(".private-message-map .user").length, 1);
|
||||
}
|
||||
});
|
||||
|
@ -13,12 +13,12 @@ widgetTest("basic rendering", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$(".names").length);
|
||||
assert.ok(this.$("span.username").length);
|
||||
assert.ok(this.$("a[data-user-card=eviltrout]").length);
|
||||
assert.equal(this.$(".username a").text(), "eviltrout");
|
||||
assert.equal(this.$(".full-name a").text(), "Robin Ward");
|
||||
assert.equal(this.$(".user-title").text(), "Trout Master");
|
||||
assert.ok(find(".names").length);
|
||||
assert.ok(find("span.username").length);
|
||||
assert.ok(find("a[data-user-card=eviltrout]").length);
|
||||
assert.equal(find(".username a").text(), "eviltrout");
|
||||
assert.equal(find(".full-name a").text(), "Robin Ward");
|
||||
assert.equal(find(".user-title").text(), "Trout Master");
|
||||
}
|
||||
});
|
||||
|
||||
@ -36,12 +36,12 @@ widgetTest("extra classes and glyphs", {
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$("span.staff").length);
|
||||
assert.ok(this.$("span.admin").length);
|
||||
assert.ok(this.$("span.moderator").length);
|
||||
assert.ok(this.$(".d-icon-shield-alt").length);
|
||||
assert.ok(this.$("span.new-user").length);
|
||||
assert.ok(this.$("span.fish").length);
|
||||
assert.ok(find("span.staff").length);
|
||||
assert.ok(find("span.admin").length);
|
||||
assert.ok(find("span.moderator").length);
|
||||
assert.ok(find(".d-icon-shield-alt").length);
|
||||
assert.ok(find("span.new-user").length);
|
||||
assert.ok(find("span.fish").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -52,7 +52,7 @@ widgetTest("disable display name on posts", {
|
||||
this.set("args", { username: "eviltrout", name: "Robin Ward" });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".full-name").length, 0);
|
||||
assert.equal(find(".full-name").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -64,6 +64,6 @@ widgetTest("doesn't render a name if it's similar to the username", {
|
||||
this.set("args", { username: "eviltrout", name: "evil-trout" });
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$(".second").length, 0);
|
||||
assert.equal(find(".second").length, 0);
|
||||
}
|
||||
});
|
||||
|
@ -6,12 +6,12 @@ widgetTest("basics", {
|
||||
template: '{{mount-widget widget="user-menu"}}',
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".user-menu").length);
|
||||
assert.ok(this.$(".user-activity-link").length);
|
||||
assert.ok(this.$(".user-bookmarks-link").length);
|
||||
assert.ok(this.$(".user-preferences-link").length);
|
||||
assert.ok(this.$(".notifications").length);
|
||||
assert.ok(this.$(".dismiss-link").length);
|
||||
assert.ok(find(".user-menu").length);
|
||||
assert.ok(find(".user-activity-link").length);
|
||||
assert.ok(find(".user-bookmarks-link").length);
|
||||
assert.ok(find(".user-preferences-link").length);
|
||||
assert.ok(find(".notifications").length);
|
||||
assert.ok(find(".dismiss-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -47,7 +47,7 @@ widgetTest("log out", {
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(this.$(".logout").length);
|
||||
assert.ok(find(".logout").length);
|
||||
|
||||
await click(".logout");
|
||||
assert.ok(this.loggedOut);
|
||||
@ -61,7 +61,7 @@ widgetTest("private messages - disabled", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".user-pms-link").length);
|
||||
assert.ok(!find(".user-pms-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -72,7 +72,7 @@ widgetTest("private messages - enabled", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".user-pms-link").length);
|
||||
assert.ok(find(".user-pms-link").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -89,7 +89,7 @@ widgetTest("anonymous", {
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(this.$(".enable-anonymous").length);
|
||||
assert.ok(find(".enable-anonymous").length);
|
||||
await click(".enable-anonymous");
|
||||
assert.ok(this.anonymous);
|
||||
}
|
||||
@ -103,7 +103,7 @@ widgetTest("anonymous - disabled", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!this.$(".enable-anonymous").length);
|
||||
assert.ok(!find(".enable-anonymous").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -119,7 +119,7 @@ widgetTest("anonymous - switch back", {
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(this.$(".disable-anonymous").length);
|
||||
assert.ok(find(".disable-anonymous").length);
|
||||
await click(".disable-anonymous");
|
||||
assert.ok(this.anonymous);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ widgetTest("widget attributes are passed in via args", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$(".test").text(), "Hello Robin");
|
||||
assert.equal(find(".test").text(), "Hello Robin");
|
||||
}
|
||||
});
|
||||
|
||||
@ -34,7 +34,7 @@ widgetTest("hbs template - no tagName", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$("div.test").text(), "Hello Robin");
|
||||
assert.equal(find("div.test").text(), "Hello Robin");
|
||||
}
|
||||
});
|
||||
|
||||
@ -51,7 +51,7 @@ widgetTest("hbs template - with tagName", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$("div.test").text(), "Hello Robin");
|
||||
assert.equal(find("div.test").text(), "Hello Robin");
|
||||
}
|
||||
});
|
||||
|
||||
@ -71,10 +71,7 @@ widgetTest("buildClasses", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(
|
||||
this.$(".test.static.cool-class").length,
|
||||
"it has all the classes"
|
||||
);
|
||||
assert.ok(find(".test.static.cool-class").length, "it has all the classes");
|
||||
}
|
||||
});
|
||||
|
||||
@ -94,8 +91,8 @@ widgetTest("buildAttributes", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".test[data-evil=trout]").length);
|
||||
assert.ok(this.$(".test[aria-label=accessibility]").length);
|
||||
assert.ok(find(".test[data-evil=trout]").length);
|
||||
assert.ok(find(".test[aria-label=accessibility]").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -113,7 +110,7 @@ widgetTest("buildId", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$("#test-1234").length);
|
||||
assert.ok(find("#test-1234").length);
|
||||
}
|
||||
});
|
||||
|
||||
@ -137,11 +134,11 @@ widgetTest("widget state", {
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.ok(this.$("button.test").length, "it renders the button");
|
||||
assert.equal(this.$("button.test").text(), "0 clicks");
|
||||
assert.ok(find("button.test").length, "it renders the button");
|
||||
assert.equal(find("button.test").text(), "0 clicks");
|
||||
|
||||
await click(this.$("button"));
|
||||
assert.equal(this.$("button.test").text(), "1 clicks");
|
||||
await click(find("button"));
|
||||
assert.equal(find("button.test").text(), "1 clicks");
|
||||
}
|
||||
});
|
||||
|
||||
@ -173,15 +170,15 @@ widgetTest("widget update with promise", {
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
this.$("button.test")
|
||||
find("button.test")
|
||||
.text()
|
||||
.trim(),
|
||||
"No name"
|
||||
);
|
||||
|
||||
await click(this.$("button"));
|
||||
await click(find("button"));
|
||||
assert.equal(
|
||||
this.$("button.test")
|
||||
find("button.test")
|
||||
.text()
|
||||
.trim(),
|
||||
"Robin"
|
||||
@ -202,8 +199,8 @@ widgetTest("widget attaching", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".container").length, "renders container");
|
||||
assert.ok(this.$(".container .embedded").length, "renders attached");
|
||||
assert.ok(find(".container").length, "renders container");
|
||||
assert.ok(find(".container .embedded").length, "renders attached");
|
||||
}
|
||||
});
|
||||
|
||||
@ -217,7 +214,7 @@ widgetTest("handlebars d-icon", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$(".d-icon-arrow-down").length, 1);
|
||||
assert.equal(find(".d-icon-arrow-down").length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
@ -243,9 +240,9 @@ widgetTest("handlebars i18n", {
|
||||
|
||||
test(assert) {
|
||||
// comin up
|
||||
assert.equal(this.$("span.string").text(), "evil");
|
||||
assert.equal(this.$("span.var").text(), "trout");
|
||||
assert.equal(this.$("a").prop("title"), "evil");
|
||||
assert.equal(find("span.string").text(), "evil");
|
||||
assert.equal(find("span.var").text(), "trout");
|
||||
assert.equal(find("a").prop("title"), "evil");
|
||||
}
|
||||
});
|
||||
|
||||
@ -268,8 +265,8 @@ widgetTest("handlebars #each", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$("ul li").length, 3);
|
||||
assert.equal(this.$("ul li:eq(0)").text(), "one");
|
||||
assert.equal(find("ul li").length, 3);
|
||||
assert.equal(find("ul li:eq(0)").text(), "one");
|
||||
}
|
||||
});
|
||||
|
||||
@ -294,9 +291,9 @@ widgetTest("widget decorating", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(this.$(".decorate").length);
|
||||
assert.equal(this.$(".decorate b").text(), "before");
|
||||
assert.equal(this.$(".decorate i").text(), "after");
|
||||
assert.ok(find(".decorate").length);
|
||||
assert.equal(find(".decorate b").text(), "before");
|
||||
assert.equal(find(".decorate i").text(), "after");
|
||||
}
|
||||
});
|
||||
|
||||
@ -312,7 +309,7 @@ widgetTest("widget settings", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$(".settings").text(), "age is 36");
|
||||
assert.equal(find(".settings").text(), "age is 36");
|
||||
}
|
||||
});
|
||||
|
||||
@ -332,6 +329,6 @@ widgetTest("override settings", {
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$(".settings").text(), "age is 37");
|
||||
assert.equal(find(".settings").text(), "age is 37");
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user