Skip to content
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

Merged

Conversation

lucaslyl
Copy link
Contributor

@lucaslyl lucaslyl commented Mar 4, 2025

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

@lucaslyl lucaslyl self-assigned this Mar 4, 2025
Copy link

github-actions bot commented Mar 4, 2025

Host Test Results

    1 files  ±0      1 suites  ±0   24m 33s ⏱️ -3s
793 tests +1  791 ✔️ +1  2 💤 ±0  0 ±0 
798 runs  +1  796 ✔️ +1  2 💤 ±0  0 ±0 

Results for commit c98ca6c. ± Comparison against base commit 4dc9310.

♻️ This comment has been updated with latest results.

@lucaslyl lucaslyl marked this pull request as ready for review March 4, 2025 17:02
const selectedUrl = new URL(this.args.selectedId);
this.operatorModeStateService.updateCodePath(selectedUrl);
} catch (error) {
console.error('Failed to open spec instance:', error);
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@tintinthong tintinthong left a 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]');
Copy link
Contributor

@tintinthong tintinthong Mar 5, 2025

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

@tintinthong tintinthong self-requested a review March 5, 2025 03:53
Copy link
Contributor

@tintinthong tintinthong left a 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"

@lucaslyl lucaslyl requested a review from tintinthong March 5, 2025 06:38
Comment on lines 497 to 498
assert.dom('[data-test-module-href]').containsText(`${testRealmURL}person`);
assert.dom('[data-test-exported-name]').containsText('Person');
Copy link
Contributor

@tintinthong tintinthong Mar 5, 2025

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="">
      

Copy link
Contributor Author

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

@lucaslyl lucaslyl merged commit 2b8e67c into main Mar 6, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants