Skip to content

Commit 557d953

Browse files
committed
fix-tests
1 parent 09ff8fe commit 557d953

File tree

5 files changed

+11
-29
lines changed

5 files changed

+11
-29
lines changed

app/assets/javascripts/discourse/app/controllers/topic.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { service } from "@ember/service";
88
import { isEmpty, isPresent } from "@ember/utils";
99
import { observes } from "@ember-decorators/object";
1010
import BufferedProxy from "ember-buffered-proxy/proxy";
11+
import { log } from "qunit";
1112
import { Promise } from "rsvp";
1213
import {
1314
CLOSE_INITIATED_BY_BUTTON,
@@ -102,7 +103,6 @@ export default class TopicController extends Controller {
102103
currentPostId = null;
103104
userLastReadPostNumber = null;
104105
highestPostNumber = null;
105-
titleTextHighlighted = false;
106106
_progressIndex = null;
107107
_retryInProgress = false;
108108
_retryRateLimited = false;
@@ -400,19 +400,6 @@ export default class TopicController extends Controller {
400400
this.editTopic(event);
401401
}
402402

403-
@action
404-
handlePointerMove() {
405-
const selection = window.getSelection();
406-
this.set("titleTextHighlighted", selection.toString().length > 0);
407-
}
408-
409-
@action
410-
handlePointerUp(event) {
411-
if (!this.titleTextHighlighted) {
412-
this.editTopic(event);
413-
}
414-
}
415-
416403
@action
417404
removeFeaturedLink(event) {
418405
event?.preventDefault();

app/assets/javascripts/discourse/app/templates/topic.gjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export default RouteTemplate(
103103
"title-wrapper"
104104
(if @controller.editingTopic "editing-topic")
105105
(if @controller.model.details.can_edit "can-edit-topic")
106-
(if @controller.titleTextHighlighted "title-highlighted")
107106
}}
108107
>
109108
{{#if @controller.editingTopic}}
@@ -214,8 +213,7 @@ export default RouteTemplate(
214213
role="button"
215214
class={{concatClass "title-wrapper edit-topic"}}
216215
aria-label={{i18n "edit_topic"}}
217-
{{on "pointermove" @controller.handlePointerMove}}
218-
{{on "pointerup" @controller.handlePointerUp}}
216+
{{on "click" @controller.titleClick}}
219217
title={{i18n "edit_topic"}}
220218
>
221219
{{#unless @controller.model.is_warning}}

app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { click, fillIn, triggerEvent, visit } from "@ember/test-helpers";
1+
import { click, fillIn, visit } from "@ember/test-helpers";
22
import { test } from "qunit";
33
import sinon from "sinon";
44
import { cloneJSON } from "discourse/lib/object";
@@ -112,9 +112,7 @@ acceptance("Composer Actions", function (needs) {
112112

113113
await visit("/t/internationalization-localization/280");
114114

115-
await triggerEvent("#topic-title .can-edit-topic", "pointerdown");
116-
await triggerEvent("#topic-title .can-edit-topic", "pointermove");
117-
await triggerEvent("#topic-title .can-edit-topic", "pointerup");
115+
await click("#topic-title .can-edit-topic .edit-topic");
118116
await categoryChooser.expand();
119117
await categoryChooser.selectRowByValue(4);
120118
await click("#topic-title .submit-edit");

app/assets/javascripts/discourse/tests/acceptance/topic-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ import { i18n } from "discourse-i18n";
106106
test("Showing and hiding the edit controls", async function (assert) {
107107
await visit("/t/internationalization-localization/280");
108108

109-
await click("#topic-title .can-edit-topic");
109+
await click("#topic-title .can-edit-topic .edit-topic");
110110

111111
assert.dom("#edit-title").exists("shows the editing controls");
112112
assert
@@ -123,7 +123,7 @@ import { i18n } from "discourse-i18n";
123123

124124
await visit("/t/internationalization-localization/280");
125125

126-
await click("#topic-title .can-edit-topic");
126+
await click("#topic-title .can-edit-topic .edit-topic");
127127
await fillIn("#edit-title", "this is the new title");
128128
await categoryChooser.expand();
129129
await categoryChooser.selectRowByValue(4);
@@ -168,7 +168,7 @@ import { i18n } from "discourse-i18n";
168168

169169
test("Updating the topic title with emojis", async function (assert) {
170170
await visit("/t/internationalization-localization/280");
171-
await click("#topic-title .can-edit-topic");
171+
await click("#topic-title .can-edit-topic .edit-topic");
172172

173173
await fillIn("#edit-title", "emojis title :bike: :blonde_woman:t6:");
174174

@@ -181,7 +181,7 @@ import { i18n } from "discourse-i18n";
181181

182182
test("Updating the topic title with unicode emojis", async function (assert) {
183183
await visit("/t/internationalization-localization/280");
184-
await click("#topic-title .can-edit-topic");
184+
await click("#topic-title .can-edit-topic .edit-topic");
185185

186186
await fillIn("#edit-title", "emojis title 👨‍🌾🙏");
187187

@@ -195,7 +195,7 @@ import { i18n } from "discourse-i18n";
195195
test("Updating the topic title with unicode emojis without whitespace", async function (assert) {
196196
this.siteSettings.enable_inline_emoji_translation = true;
197197
await visit("/t/internationalization-localization/280");
198-
await click("#topic-title .can-edit-topic");
198+
await click("#topic-title .can-edit-topic .edit-topic");
199199

200200
await fillIn("#edit-title", "Test🙂Title");
201201

@@ -298,7 +298,7 @@ import { i18n } from "discourse-i18n";
298298
.exists("link is shown with topic title");
299299

300300
assert.dom(".title-wrapper").exists("title wrapper is shown");
301-
await click("#topic-title .can-edit-topic");
301+
await click("#topic-title .can-edit-topic .edit-topic");
302302
assert
303303
.dom(".title-wrapper .remove-featured-link")
304304
.exists("link to remove featured link");

app/assets/stylesheets/common/base/topic.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@
200200
cursor: pointer;
201201
}
202202

203-
&.can-edit-topic:not(.editing-topic, .title-highlighted):hover
204-
.fancy-title {
203+
&.can-edit-topic:not(.editing-topic):hover .fancy-title {
205204
outline: 2px solid var(--primary-300);
206205
}
207206

0 commit comments

Comments
 (0)