Replace Rose::CodeEditor with Hds::CodeEditor (#2679)

* chore: 🤖 replace Rose::CodeEditor with Hds::CodeEditor

- Remove CodeEditor 5 dependency

* chore: 🤖 Replace CodeMirror5 dep

remove CodeMirror5 and replace existing editors with HDS::CodeEditor

* chore: 🤖 deleting old codeeditor styles

* feat: 🎸 changing code editor

changing code editor

✅ Closes: 0

* removed unused export

* pr cleanup

* updating tests for new code editor

* responding to PR feedback

* added whitespace

* fixing linting violations

* chore: 🤖 self-review PR

self-review PR in the course of switching to new HDS code editor

* fix: 🐛 fix linting bug

* fix: 🐛 unneeded dependency

remove jslint dependency as this is handled in the new code editor from
HDS

* fix: 🐛 Fixing import bug

Fix import bug caused by importing scss modules that no longer exist

* Fix and refactor code editor acceptance test

* Fix and refactor code editor acceptance test

* chore: 🤖 remove codemirror dependency

* refactor: 💡 fix merge conflict issues

* test: 💍 update e2e test selectors

* test: 💍 fix target spec click event

* refactor: 💡 clean up test selectors for code editor

* refactor: 💡 clean up storage bucket test selectors

* chore: 🤖 remove code mirror modifiers

---------

Co-authored-by: calcaide <ccorvo@hashicorp.com>
Co-authored-by: cameronperera <cameron.perera@hashicorp.com>
This commit is contained in:
authored and Zhihe Li committed 2026-05-14 15:21:27 -04:00
1 parent fd1eba617b
commit d469f305de
41 files changed
+354 -744

No files matched your search

@@ -4,7 +4,14 @@
*/
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
import {
visit,
currentURL,
click,
fillIn,
find,
waitFor,
} from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { Response } from 'miragejs';
@@ -426,15 +433,24 @@ module(
await click(selectors.TYPE_SELECT);
await click(selectors.FIELD_TYPE_JSON);
await fillIn(selectors.FIELD_EDITOR, selectors.FIELD_EDITOR_VALUE);
assert.dom(selectors.EDITOR).includesText(selectors.FIELD_EDITOR_VALUE);
await waitFor(commonSelectors.CODE_EDITOR_CM);
await click(selectors.TYPE_SELECT);
await click(selectors.FIELD_TYPE_USERNAME_PASSWORD);
const editorElement = find(commonSelectors.CODE_EDITOR_CODE);
const editorView = editorElement.editor;
editorView.dispatch({
changes: {
from: editorView.state.selection.main.from,
insert: '{"test": "value"}',
},
});
assert
.dom(commonSelectors.CODE_EDITOR_CODE)
.includesText('{"test": "value"}');
await click(selectors.TYPE_SELECT);
await click(selectors.FIELD_TYPE_JSON);
assert.dom(selectors.EDITOR).includesText('{}');
assert.dom(commonSelectors.CODE_EDITOR_CODE).includesText('{}');
});
test('users can cancel creation of new password credential', async function (assert) {
@@ -8,6 +8,7 @@ export const FIELD_TYPE_USERNAME_PASSWORD = '[data-option-index="0"]';
export const FIELD_TYPE_USERNAME_PASSWORD_DOMAIN = '[data-option-index="2"]';
export const FIELD_TYPE_JSON = '[data-option-index="3"]';
export const FIELD_TYPE_PASSWORD = '[data-option-index="4"]';
export const FIELD_DOMAIN = '[name=domain]';
export const FIELD_PASSWORD = '[name=password]';
export const FIELD_USERNAME = '[name=username]';
@@ -16,8 +17,6 @@ export const FIELD_USERNAME_VALUE = 'username123';
export const FIELD_PASSWORD_VALUE = 'password123';
export const FIELD_USERNAME_WITH_DOMAIN_VALUE = 'username@g.com';
export const FIELD_EDITOR = '[data-test-code-editor-field-editor] textarea';
export const FIELD_EDITOR_VALUE = '{"test": "value"}';
export const FIELD_PASSWORD_ERROR = '[data-test-error-message-password]';
export const FIELD_SSH_PRIVATE_KEY = '[name=private_key]';
export const FIELD_DOMAIN_ERROR = '[data-test-error-message-domain]';
@@ -25,7 +24,6 @@ export const FIELD_SSH_PRIVATE_KEY_ERROR =
'[data-test-error-message-private-key]';
export const FIELD_SSH_PRIVATE_KEY_PASSPHRASE = '[name=private_key_passphrase]';
export const EDITOR = '[data-test-code-editor-field-editor]';
export const MANAGE_DROPDOWN = '[data-test-manage-credentials-dropdown] button';
export const MANAGE_DROPDOWN_DELETE =
'[data-test-manage-credentials-dropdown] ul li button';