mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 03:22:46 +08:00
Add tests
This commit is contained in:
parent
c0cbfcc548
commit
6252e166a9
|
@ -1,4 +1,8 @@
|
|||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { visit } from "@ember/test-helpers";
|
||||
|
||||
|
@ -9,6 +13,12 @@ acceptance("Topic Discovery - Mobile", function (needs) {
|
|||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||
|
||||
assert.equal(
|
||||
queryAll("a[data-user-card=codinghorror] img.avatar").attr("loading"),
|
||||
"lazy",
|
||||
"it adds loading=`lazy` to topic list avatars"
|
||||
);
|
||||
|
||||
await visit("/categories");
|
||||
assert.ok(exists(".category"), "has a list of categories");
|
||||
});
|
||||
|
|
|
@ -27,6 +27,12 @@ acceptance("Topic Discovery", function (needs) {
|
|||
"it shows user's full name in avatar title"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
queryAll("a[data-user-card=eviltrout] img.avatar").attr("loading"),
|
||||
"lazy",
|
||||
"it adds loading=`lazy` to topic list avatars"
|
||||
);
|
||||
|
||||
await visit("/c/bug");
|
||||
assert.ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
assert.ok(exists(".topic-list .topic-list-item"), "has topics");
|
||||
|
|
|
@ -100,7 +100,7 @@ discourseModule("Unit | Utilities", function () {
|
|||
let avatarTemplate = "/path/to/avatar/{size}.png";
|
||||
assert.equal(
|
||||
avatarImg({ avatarTemplate: avatarTemplate, size: "tiny" }),
|
||||
"<img alt='' width='20' height='20' src='/path/to/avatar/40.png' class='avatar'>",
|
||||
"<img loading='lazy' alt='' width='20' height='20' src='/path/to/avatar/40.png' class='avatar'>",
|
||||
"it returns the avatar html"
|
||||
);
|
||||
|
||||
|
@ -110,7 +110,7 @@ discourseModule("Unit | Utilities", function () {
|
|||
size: "tiny",
|
||||
title: "evilest trout",
|
||||
}),
|
||||
"<img alt='' width='20' height='20' src='/path/to/avatar/40.png' class='avatar' title='evilest trout' aria-label='evilest trout'>",
|
||||
"<img loading='lazy' alt='' width='20' height='20' src='/path/to/avatar/40.png' class='avatar' title='evilest trout' aria-label='evilest trout'>",
|
||||
"it adds a title if supplied"
|
||||
);
|
||||
|
||||
|
@ -120,7 +120,7 @@ discourseModule("Unit | Utilities", function () {
|
|||
size: "tiny",
|
||||
extraClasses: "evil fish",
|
||||
}),
|
||||
"<img alt='' width='20' height='20' src='/path/to/avatar/40.png' class='avatar evil fish'>",
|
||||
"<img loading='lazy' alt='' width='20' height='20' src='/path/to/avatar/40.png' class='avatar evil fish'>",
|
||||
"it adds extra classes if supplied"
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user