DEV: uses find() helper instead of this.$() in js tests (#7062)

This commit is contained in:
Joffrey JAFFEUX
2019-02-25 16:04:55 +01:00
committed by GitHub
parent c0dd171cf1
commit 5952a6c0ad
22 changed files with 332 additions and 318 deletions

View File

@ -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"
);