-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cs 8060 make spec navigatable to the instance in code mode #2242
Cs 8060 make spec navigatable to the instance in code mode #2242
Conversation
const selectedUrl = new URL(this.args.selectedId); | ||
this.operatorModeStateService.updateCodePath(selectedUrl); | ||
} catch (error) { | ||
console.error('Failed to open spec instance:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an expected circumstance? If not, I don't think we need the try/catch. We can just let the failure bubble. If so, we should have test coverage for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, you're right. This isn't an expected circumstance. I'll remove the try/catch and let any failures bubble up naturally. Thanks for the advice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"View Instance" seems like a better use of words imo.
@@ -351,6 +353,8 @@ module('Acceptance | Spec preview', function (hooks) { | |||
assert | |||
.dom('[data-test-spec-selector-item-path]') | |||
.hasText('pet-entry-2.json'); | |||
assert.dom('[data-test-view-spec-instance]').exists(); | |||
await click('[data-test-view-spec-instance]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to have another test that clicks on the button and assert that you have the spec instance in the RHS rendered in isolated mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add test and change to "View Instance"
… and displays content in editor
assert.dom('[data-test-module-href]').containsText(`${testRealmURL}person`); | ||
assert.dom('[data-test-exported-name]').containsText('Person'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I said "Check that it opens in isolated mode". You can use the attributes here (data-test-card-format)
<div id="ember1609" class="ember-view boxel-card-container boundaries field-component-card
isolated-format display-container-true" data-scopedcss-35a90eaf3c-4ee8da6495="" data-test-boxel-card-container="" data-test-card="http://localhost:4201/experiments/Spec/1" data-test-card-format="isolated" data-test-field-component-card="" data-scopedcss-b8fe299739-015c45ff6d="" data-scopedcss-6ef7616ef3-bc76e072f4="">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I have studied other file patterns to apply this change with:
[data-test-card="${testRealmURL}person-entry"][data-test-card-format="isolated"]
I'm applying the check on data-test-card specifically to ensure we're targeting the exact card instance we need
linear: https://linear.app/cardstack/issue/CS-8060/make-spec-navigatable-to-the-instance-in-code-mode
Result:
Screen.Recording.2025-03-04.at.23.14.31.mov