DEV: introduces prettier for es6 files

This commit is contained in:
Joffrey JAFFEUX
2018-06-15 17:03:24 +02:00
committed by GitHub
parent c7ee70941e
commit 03a7d532cf
1162 changed files with 60667 additions and 29659 deletions

View File

@ -1,10 +1,12 @@
import { acceptance } from "helpers/qunit-helpers";
import { IMAGE_VERSION as v } from 'pretty-text/emoji';
import { resetCache } from 'discourse/components/emoji-picker';
import { IMAGE_VERSION as v } from "pretty-text/emoji";
import { resetCache } from "discourse/components/emoji-picker";
acceptance("EmojiPicker", {
loggedIn: true,
beforeEach() { resetCache(); }
beforeEach() {
resetCache();
}
});
QUnit.test("emoji picker can be opened/closed", assert => {
@ -14,7 +16,9 @@ QUnit.test("emoji picker can be opened/closed", assert => {
click("button.emoji.btn");
andThen(() => {
assert.notEqual(
find('.emoji-picker').html().trim(),
find(".emoji-picker")
.html()
.trim(),
"",
"it opens the picker"
);
@ -23,10 +27,12 @@ QUnit.test("emoji picker can be opened/closed", assert => {
click("button.emoji.btn");
andThen(() => {
assert.equal(
find('.emoji-picker').html().trim(),
find(".emoji-picker")
.html()
.trim(),
"",
"it closes the picker"
);
);
});
});
@ -36,10 +42,12 @@ QUnit.test("emojis can be hovered to display info", assert => {
click("button.emoji.btn");
andThen(() => {
$(".emoji-picker button[title='grinning']").trigger('mouseover');
$(".emoji-picker button[title='grinning']").trigger("mouseover");
andThen(() => {
assert.equal(
find('.emoji-picker .info').html().trim(),
find(".emoji-picker .info")
.html()
.trim(),
`<img src=\"/images/emoji/emoji_one/grinning.png?v=${v}\" class=\"emoji\"> <span>:grinning:<span></span></span>`,
"it displays emoji info when hovering emoji"
);
@ -55,7 +63,7 @@ QUnit.test("emoji picker triggers event when picking emoji", assert => {
click(".emoji-picker button[title='grinning']");
andThen(() => {
assert.equal(
find('.d-editor-input').val(),
find(".d-editor-input").val(),
":grinning:",
"it adds the emoji code in the editor when selected"
);
@ -67,7 +75,9 @@ QUnit.test("emoji picker has a list of recently used emojis", assert => {
click("#topic-footer-buttons .btn.create");
click("button.emoji.btn");
click(".emoji-picker .section[data-section='people'] button.emoji[title='grinning']");
click(
".emoji-picker .section[data-section='people'] button.emoji[title='grinning']"
);
andThen(() => {
assert.equal(
find('.emoji-picker .section[data-section="recent"]').css("display"),
@ -76,7 +86,9 @@ QUnit.test("emoji picker has a list of recently used emojis", assert => {
);
assert.equal(
find('.emoji-picker .section[data-section="recent"] .section-group button.emoji').length,
find(
'.emoji-picker .section[data-section="recent"] .section-group button.emoji'
).length,
1,
"it adds the emoji code to the recently used emojis list"
);
@ -85,7 +97,9 @@ QUnit.test("emoji picker has a list of recently used emojis", assert => {
click(".emoji-picker .clear-recent");
andThen(() => {
assert.equal(
find('.emoji-picker .section[data-section="recent"] .section-group button.emoji').length,
find(
'.emoji-picker .section[data-section="recent"] .section-group button.emoji'
).length,
0,
"it has cleared recent emojis"
);
@ -97,7 +111,9 @@ QUnit.test("emoji picker has a list of recently used emojis", assert => {
);
assert.equal(
find('.emoji-picker .category-icon button.emoji[data-section="recent"]').parent().css("display"),
find('.emoji-picker .category-icon button.emoji[data-section="recent"]')
.parent()
.css("display"),
"none",
"it hides recent category icon"
);
@ -114,13 +130,18 @@ QUnit.test("emoji picker correctly orders recently used emojis", assert => {
click(".emoji-picker button[title='grinning']");
andThen(() => {
assert.equal(
find('.section[data-section="recent"] .section-group button.emoji').length,
find('.section[data-section="recent"] .section-group button.emoji')
.length,
2,
"it has multiple recent emojis"
);
assert.equal(
/grinning/.test(find('.section[data-section="recent"] .section-group button.emoji').first().css('background-image')),
/grinning/.test(
find('.section[data-section="recent"] .section-group button.emoji')
.first()
.css("background-image")
),
true,
"it puts the last used emoji in first"
);
@ -136,28 +157,29 @@ QUnit.test("emoji picker lazy loads emojis", assert => {
andThen(() => {
assert.equal(
find('.emoji-picker button[title="massage_woman"]').css("background-image"),
find('.emoji-picker button[title="massage_woman"]').css(
"background-image"
),
"none",
"it doesn't load invisible emojis"
);
});
});
QUnit.test("emoji picker persists state", assert => {
visit("/t/internationalization-localization/280");
click("#topic-footer-buttons .btn.create");
click("button.emoji.btn");
andThen(() => {
click('.emoji-picker a.diversity-scale.medium-dark');
click(".emoji-picker a.diversity-scale.medium-dark");
});
click("button.emoji.btn");
click("button.emoji.btn");
andThen(() => {
assert.equal(
find('.emoji-picker .diversity-scale.medium-dark').hasClass('selected'),
find(".emoji-picker .diversity-scale.medium-dark").hasClass("selected"),
true,
"it stores diversity scale"
);