Repository navigation
feat(approval): make the approval card collapsible (#3007) #3515
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| ROOT = Path(__file__).resolve().parent.parent | ||
| MESSAGES_JS = (ROOT / "static" / "messages.js").read_text(encoding="utf-8") | ||
| STYLE_CSS = (ROOT / "static" / "style.css").read_text(encoding="utf-8") | ||
| INDEX_HTML = (ROOT / "static" / "index.html").read_text(encoding="utf-8") | ||
|
|
||
|
|
||
| def _compact(text: str) -> str: | ||
| return "".join(text.split()) | ||
|
|
||
|
|
||
| def test_toggle_approval_card_collapsed_defined(): | ||
| assert "function toggleApprovalCardCollapsed(" in MESSAGES_JS | ||
|
|
||
|
|
||
| def test_sync_approval_collapse_button_defined(): | ||
| assert "function _syncApprovalCollapseButton(" in MESSAGES_JS | ||
|
|
||
|
|
||
| def test_sync_approval_transcript_space_defined(): | ||
| assert "function _syncApprovalTranscriptSpace(" in MESSAGES_JS | ||
|
|
||
|
|
||
| def test_approval_collapsed_toggle_in_messages_js(): | ||
| compact_js = _compact(MESSAGES_JS) | ||
| assert 'card.classList.toggle("collapsed",collapsed)' in compact_js | ||
|
|
||
|
|
||
| def test_approval_collapsed_cleared_in_hide(): | ||
| # hideApprovalCard must reset collapse state so next approval opens expanded | ||
| compact_js = _compact(MESSAGES_JS) | ||
| assert 'card.classList.remove("collapsed")' in compact_js | ||
|
|
||
|
|
||
| def test_messages_approval_open_in_css(): | ||
| assert ".messages.approval-open" in STYLE_CSS | ||
|
|
||
|
|
||
| def test_messages_approval_collapsed_in_css(): | ||
| assert ".messages.approval-collapsed" in STYLE_CSS | ||
|
|
||
|
|
||
| def test_approval_dock_height_padding_in_css(): | ||
| compact_css = _compact(STYLE_CSS) | ||
| assert "padding-bottom:var(--approval-dock-height,72px)" in compact_css | ||
|
|
||
|
|
||
| def test_approval_card_collapsed_header_margin_in_css(): | ||
| assert ".approval-card.collapsed .approval-header" in STYLE_CSS | ||
|
|
||
|
|
||
| def test_approval_card_collapsed_desc_hidden_in_css(): | ||
| assert ".approval-card.collapsed .approval-desc" in STYLE_CSS | ||
|
|
||
|
|
||
| def test_approval_collapse_button_in_html(): | ||
| assert 'id="approvalCollapse"' in INDEX_HTML | ||
|
|
||
|
|
||
| def test_approval_collapse_aria_expanded_in_html(): | ||
| assert 'aria-expanded="true"' in INDEX_HTML | ||
|
|
||
|
|
||
| def test_approval_collapse_onclick_in_html(): | ||
| assert 'onclick="toggleApprovalCardCollapsed()"' in INDEX_HTML | ||
|
|
||
|
|
||
| def test_sync_approval_transcript_space_called_in_show_and_hide(): | ||
| # Must be called from both showApprovalCard and hideApprovalCard | ||
| compact_js = _compact(MESSAGES_JS) | ||
| assert compact_js.count("_syncApprovalTranscriptSpace(") >= 3 # show, hide, toggle | ||
| assert "_syncApprovalTranscriptSpace(null)" in MESSAGES_JS | ||
| # show mirrors the merged clarify card: mark visible first, then sync immediately so the transcript reserves space on first paint | ||
| assert 'card.classList.add("visible");_syncApprovalCollapseButton(card);_syncApprovalTranscriptSpace(card,{immediate:true})' in compact_js |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.