address comments

This commit is contained in:
Huey 2022-11-22 10:34:23 +08:00
parent 3c6d43b598
commit a594e53d71
No known key found for this signature in database
GPG key ID: 54C82E718C137231
3 changed files with 20 additions and 18 deletions

View file

@ -24,6 +24,9 @@
"allowTemplateLiterals": false "allowTemplateLiterals": false
}], }],
"brace-style": 2, "brace-style": 2,
"keyword-spacing": ["error", {
"after": true
}],
// just to make sure (are defaults) // just to make sure (are defaults)
"indent": ["error", 4], "indent": ["error", 4],

View file

@ -39,7 +39,7 @@ function onClickInteract(event) {
* Wait for element to appear. * Wait for element to appear.
* *
* @param {string} selector * @param {string} selector
* @param {boolean} multiple * @param {boolean} [multiple=false]
* @param {number} timeoutDuration * @param {number} timeoutDuration
* @see {@link https://github.com/storybookjs/test-runner/blob/6d41927154e8dd1e4c9e7493122e24e2739a7a0f/src/setup-page.ts#L134} * @see {@link https://github.com/storybookjs/test-runner/blob/6d41927154e8dd1e4c9e7493122e24e2739a7a0f/src/setup-page.ts#L134}
* from which this was adapted * from which this was adapted
@ -103,7 +103,6 @@ async function injectFollowButton() {
*/ */
async function injectInteractionButtons() { async function injectInteractionButtons() {
const INJECTED_REPLY_CLASS = "mastodon-simplified-federation-injected-interaction"; const INJECTED_REPLY_CLASS = "mastodon-simplified-federation-injected-interaction";
try {
const replyButtons = await waitForElement( const replyButtons = await waitForElement(
".item-list[role='feed'] article[data-id] .status__action-bar button," + ".item-list[role='feed'] article[data-id] .status__action-bar button," +
".detailed-status__wrapper .detailed-status__action-bar button", ".detailed-status__wrapper .detailed-status__action-bar button",
@ -111,15 +110,15 @@ async function injectInteractionButtons() {
TIMEOUT_DURATION, TIMEOUT_DURATION,
); );
replyButtons.forEach((button) => { replyButtons.forEach((button) => {
try {
if (!button.classList.contains(INJECTED_REPLY_CLASS)){ if (!button.classList.contains(INJECTED_REPLY_CLASS)){
button.addEventListener("click", onClickInteract); button.addEventListener("click", onClickInteract);
button.classList.add(INJECTED_REPLY_CLASS); button.classList.add(INJECTED_REPLY_CLASS);
} }
});
} catch (error) { } catch (error) {
// Interaction buttons failed to appear // Interaction buttons failed to appear
console.log(error);
} }
});
} }
/** /**