DEV: Remove context menu timeout (#156)
This commit is contained in:
parent
3cf316fb62
commit
78558b9cf5
|
@ -7,7 +7,6 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import { createPopper } from "@popperjs/core";
|
import { createPopper } from "@popperjs/core";
|
||||||
import { caretPosition, getCaretPosition } from "discourse/lib/utilities";
|
import { caretPosition, getCaretPosition } from "discourse/lib/utilities";
|
||||||
import discourseLater from "discourse-common/lib/later";
|
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AiHelperContextMenu extends Component {
|
export default class AiHelperContextMenu extends Component {
|
||||||
|
@ -237,13 +236,6 @@ export default class AiHelperContextMenu extends Component {
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this._dEditorInput.classList.remove("loading");
|
this._dEditorInput.classList.remove("loading");
|
||||||
|
|
||||||
// Make reset options disappear by closing the context menu after 5 seconds
|
|
||||||
if (this.menuState === this.CONTEXT_MENU_STATES.resets) {
|
|
||||||
discourseLater(() => {
|
|
||||||
this.closeContextMenu();
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,22 +143,6 @@ RSpec.describe "AI Composer helper", type: :system, js: true do
|
||||||
expect(ai_helper_context_menu).to be_showing_resets
|
expect(ai_helper_context_menu).to be_showing_resets
|
||||||
end
|
end
|
||||||
|
|
||||||
it "hides reset options after 5 seconds" do
|
|
||||||
trigger_context_menu(OpenAiCompletionsInferenceStubs.spanish_text)
|
|
||||||
ai_helper_context_menu.click_ai_button
|
|
||||||
ai_helper_context_menu.select_helper_model(
|
|
||||||
OpenAiCompletionsInferenceStubs.text_mode_to_id(mode),
|
|
||||||
)
|
|
||||||
|
|
||||||
wait_for do
|
|
||||||
composer.composer_input.value == OpenAiCompletionsInferenceStubs.translated_response.strip
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(ai_helper_context_menu).to be_showing_resets
|
|
||||||
sleep 5
|
|
||||||
expect(ai_helper_context_menu).to be_not_showing_resets
|
|
||||||
end
|
|
||||||
|
|
||||||
it "reverts results when Undo button is clicked" do
|
it "reverts results when Undo button is clicked" do
|
||||||
trigger_context_menu(OpenAiCompletionsInferenceStubs.spanish_text)
|
trigger_context_menu(OpenAiCompletionsInferenceStubs.spanish_text)
|
||||||
ai_helper_context_menu.click_ai_button
|
ai_helper_context_menu.click_ai_button
|
||||||
|
|
Loading…
Reference in New Issue