You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/08 02:06:36 UTC

[PR] test(frontend): render the project list item's permission and description rules [texera]

aglinxinyuan opened a new pull request, #7415:
URL: https://github.com/apache/texera/pull/7415

   ### What changes were proposed in this PR?
   
   `UserProjectListItemComponent` decides in its template what a viewer may touch, and none of it was rendered — the existing specs call the save and colour methods directly.
   
   Adds 8 tests. The one that matters most is the `editable` gating: a project the viewer only holds READ on must not be offered the rename, add-description, share or delete controls, and that decision lives entirely in two `*ngIf="editable"` guards plus one on the action list.
   
   Also covered: the name/edit-input swap, the description starting collapsed and expanding on request, the `trim()` guard that stops a whitespace-only description rendering an empty expander, the character counter, the save icon appearing only once the text actually differs, and the creation-date format.
   
   **Verified by mutation**, all reverted (template diff empty):
   
   | Mutation | Result |
   |---|---|
   | show the rename button to a read-only viewer | red |
   | show the share/delete actions to a read-only viewer | red |
   | invert the name / edit-input branch | red |
   | drop the collapse guard | red |
   | drop the whitespace `trim()` guard | red |
   | always show the save icon | red |
   | count characters against the max instead of the text | red |
   | change the creation-date format | red |
   
   Two things worth recording:
   
   - `MarkdownModule.forRoot()` joins the TestBed. An expanded description renders a `<markdown>` element, and no existing test reached that path, so `MarkdownService` had never been needed.
   - `descriptionCollapsed` defaults to **true**. My first version of the collapse test asserted the opposite and failed, which also revealed that the whitespace test would have passed vacuously — collapsed hides the block regardless. It now expands first, so the `trim()` guard is the only thing left doing the work.
   
   No production file is touched.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7412
   
   ### How was this PR tested?
   
   ```
   npx ng test --watch=false --include="**/user-project-list-item.component.spec.ts"
   ```
   
   ```
    Test Files  1 passed (1)
         Tests  18 passed (18)
   ```
   
   8 new on top of the existing 10. `yarn format:ci` passes.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): render the project list item's permission and description rules [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7415:
URL: https://github.com/apache/texera/pull/7415#issuecomment-5223998277

   <!-- texera-reviewer-suggestion -->
   ### Automated Reviewer Suggestions
   
   Based on the `git blame` history of the changed files, we recommend the following reviewers:
   
   - **Contributors with relevant context:** `@mengw15`
     You can notify them by mentioning `@mengw15` in a comment.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): render the project list item's permission and description rules [texera]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7415:
URL: https://github.com/apache/texera/pull/7415#discussion_r3739736767


##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -218,4 +220,98 @@ describe("UserProjectListItemComponent", () => {
       expect(refreshSpy).toHaveBeenCalled();
     });
   });
+  /**
+   * The list item decides in its template what a viewer is allowed to touch and how much of a long
+   * description to show. The specs above call the save/colour methods directly, so none of the
+   * rendered gating had been pinned.
+   */
+  describe("rendered item", () => {
+    /** Re-renders the host with the given entry/editable combination. */
+    function render(over: Partial<DashboardProject> = {}, editable = true): HTMLElement {
+      hostFixture.componentInstance.entry = { ...testProject, ...over };
+      hostFixture.componentInstance.editable = editable;
+      hostFixture.detectChanges();
+      return hostFixture.nativeElement as HTMLElement;
+    }
+
+    it("shows the project name and its creation date", () => {
+      const el = render({ name: "quarterly", creationTime: januaryFirst1970 });
+
+      expect(el.textContent).toContain("quarterly");
+      expect(el.textContent).toContain("1970-01-01");
+    });

Review Comment:
   The creation-date assertion only checks for the "1970-01-01" substring, so it doesn’t pin the full `yyyy-MM-dd HH:mm` format (and can become timezone-fragile). Consider asserting the full rendered "Created:" string in the same format as the template.
   
   This issue also appears in the following locations of the same file:
   - line 254
   - line 298



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): render the project list item's permission and description rules [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #7415:
URL: https://github.com/apache/texera/pull/7415


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): render the project list item's permission and description rules [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7415:
URL: https://github.com/apache/texera/pull/7415#issuecomment-5224031800

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7415?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 84.86%. Comparing base ([`1362167`](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d61056a`](https://app.codecov.io/gh/apache/texera/commit/d61056a0abfcf08ba12ddbd56af99a5094ac0da2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on main.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main    #7415      +/-   ##
   ============================================
   + Coverage     84.70%   84.86%   +0.16%     
     Complexity     4150     4150              
   ============================================
     Files          1169     1169              
     Lines         46740    46740              
     Branches       5202     5202              
   ============================================
   + Hits          39589    39664      +75     
   + Misses         5433     5364      -69     
   + Partials       1718     1712       -6     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.50% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.85% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `50.72% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.97% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.05% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.82% <ø> (+0.36%)` | :arrow_up: | |
   | [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.89% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.55% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.31% <ø> (ø)` | | Carriedforward from [1362167](https://app.codecov.io/gh/apache/texera/commit/1362167975e93322282908bbfbe7ea8ac2c4d2fe?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7415?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): render the project list item's permission and description rules [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on code in PR #7415:
URL: https://github.com/apache/texera/pull/7415#discussion_r3740043409


##########
frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:
##########
@@ -218,4 +220,98 @@ describe("UserProjectListItemComponent", () => {
       expect(refreshSpy).toHaveBeenCalled();
     });
   });
+  /**
+   * The list item decides in its template what a viewer is allowed to touch and how much of a long
+   * description to show. The specs above call the save/colour methods directly, so none of the
+   * rendered gating had been pinned.
+   */
+  describe("rendered item", () => {
+    /** Re-renders the host with the given entry/editable combination. */
+    function render(over: Partial<DashboardProject> = {}, editable = true): HTMLElement {
+      hostFixture.componentInstance.entry = { ...testProject, ...over };
+      hostFixture.componentInstance.editable = editable;
+      hostFixture.detectChanges();
+      return hostFixture.nativeElement as HTMLElement;
+    }
+
+    it("shows the project name and its creation date", () => {
+      const el = render({ name: "quarterly", creationTime: januaryFirst1970 });
+
+      expect(el.textContent).toContain("quarterly");
+      expect(el.textContent).toContain("1970-01-01");
+    });

Review Comment:
   Good catch on both counts, and fixed in e44b491952.
   
   The substring check was weaker than I'd assumed. It happened to kill a `fullDate` mutation, but it would have sailed past `yyyy-MM-dd HH:mm:ss` — I re-ran that specific mutation to confirm, and the old assertion survived it while the new one fails. And you're right about the timezone: `januaryFirst1970` is 28,800,000 ms, so on a runner far enough west of UTC the date renders as 1969-12-31 and the test breaks for reasons that have nothing to do with the format.
   
   Rather than assert a fixed string — which would pin the runner's timezone instead of the format — it now matches the rendered line as a shape:
   
   ```
   /^Created: \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/
   ```
   
   That pins the format exactly, rejects a stray seconds field, and is indifferent to where it runs.
   
   The other two locations you flagged aren't date assertions, so nothing to change there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(frontend): render the project list item's permission and description rules [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on PR #7415:
URL: https://github.com/apache/texera/pull/7415#issuecomment-5224665752

   Both suppressed comments were worth acting on — fixed in e44b491952.
   
   **The `editable` gating.** The read-only case did already assert the add-description control, but the positive case asserted only the rename control and the existence of the actions container, so it would not have noticed either action disappearing. It now checks the add-description control too and counts the two action buttons. Verified: hiding the add-description button, and dropping one action, each now fail — neither did before.
   
   One implementation note in case it saves someone time: `nz-list-item-action` renders as an `<li>`, so counting `nz-list-item-action` elements finds zero. The assertion counts the buttons inside `ul[nz-list-item-actions]`.
   
   **The character counter.** Right — it only saw the initial value, so a counter wired to `entry.description.length` instead of `descriptionBox.value.length` would have passed. The test now types into the textarea and asserts the count follows the box; that mutation is red as of this commit.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org