-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ui): preserve required-field feedback and batch listener readiness #540
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
Draft
seonghobae
wants to merge
21
commits into
main
Choose a base branch
from
ux-validation-feedback-8834575208413136559
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+151
−37
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cb0d974
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae cfe17a1
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae ea60b2b
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae 55da6a7
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae f6c8211
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae a0e796e
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae 2868e7c
test(ui): lock required file and batch listener contracts
seonghobae 7febacc
docs(product): baseline required upload feedback
seonghobae 0e488ce
docs(changelog): record required upload feedback repair
seonghobae fb44501
docs(ui): align required-field guidance with current contract
seonghobae 9e8f2ac
test(ui): cover initial required file rejection
seonghobae fe02333
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae 25951ba
repair(required-input): restore validated contract and baseline
seonghobae 652a867
test(ui): cover required target presentation state
seonghobae 77d59e0
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae 9183ad6
test(ui): restore required-feedback coverage
seonghobae bda7934
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae b376531
🎨 Palette: 폼 유효성 검사 피드백 개선 및 인라인 스타일 제거
seonghobae 063745b
🎨 Palette: 입력 폼 검증(Validation) 관련 인라인 피드백 UI 추가 및 버그 수정
seonghobae 8794983
🎨 Palette: CHANGELOG.md 업데이트 및 불필요한 패치 파일 정리
seonghobae c2b9e68
🎨 Palette: 테스트 및 인프라 CI 환경 관련 검토 완료
seonghobae 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,89 @@ | ||
| """Contracts for required file-input feedback and batch listener readiness.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import unittest | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| SOURCE_TEXT = (Path(__file__).resolve().parents[1] / "saas_web.py").read_text( | ||
| encoding="utf-8" | ||
| ) | ||
|
|
||
|
|
||
| class EmptyFileValidationTests(unittest.TestCase): | ||
| """Single and batch file inputs must expose the same missing-required state.""" | ||
|
|
||
| @staticmethod | ||
| def _handler_between(start_marker: str, end_marker: str) -> str: | ||
| """Return one JavaScript function body from the web source text.""" | ||
|
|
||
| start = SOURCE_TEXT.index(start_marker) | ||
| end = SOURCE_TEXT.index(end_marker, start) | ||
| return SOURCE_TEXT[start:end] | ||
|
|
||
| def test_single_file_empty_state_is_explicit(self) -> None: | ||
| """Clearing the single-file control keeps visible and semantic feedback.""" | ||
|
|
||
| handler = self._handler_between( | ||
| "function updateFileSizePreview(input) {", | ||
| "document.getElementById('target_bytes').addEventListener('input'", | ||
| ) | ||
| self._assert_required_empty_state(handler, "if (!file) {") | ||
|
|
||
| def test_batch_file_empty_state_is_explicit(self) -> None: | ||
| """Clearing the batch-file control follows the same required contract.""" | ||
|
|
||
| handler = self._handler_between( | ||
| "function updateBatchFilePreview(input) {", | ||
| "document.getElementById('shrink-batch-form').addEventListener('submit'", | ||
| ) | ||
| self._assert_required_empty_state( | ||
| handler, | ||
| "if (!files || files.length === 0) {", | ||
| ) | ||
|
|
||
| def test_initial_required_file_submission_uses_same_inline_feedback(self) -> None: | ||
| """Native required rejection must populate the same visible/semantic state.""" | ||
|
|
||
| self.assertIn( | ||
| "fileInput.addEventListener('invalid', () => updateFileSizePreview(fileInput));", | ||
| SOURCE_TEXT, | ||
| ) | ||
| self.assertIn( | ||
| "batchFileInput.addEventListener('invalid', () => " | ||
| "updateBatchFilePreview(batchFileInput));", | ||
| SOURCE_TEXT, | ||
| ) | ||
|
|
||
| def test_batch_controls_exist_before_script_binds_listeners(self) -> None: | ||
| """The inline script must not dereference batch controls before they exist.""" | ||
|
|
||
| batch_form = SOURCE_TEXT.index('id="shrink-batch-form"') | ||
| script = SOURCE_TEXT.index("<script>", batch_form) | ||
| batch_listener = SOURCE_TEXT.index( | ||
| "document.getElementById('batch_preset_buttons_container').addEventListener", | ||
| script, | ||
| ) | ||
| self.assertLess(batch_form, script) | ||
| self.assertLess(script, batch_listener) | ||
|
|
||
| def _assert_required_empty_state(self, handler: str, empty_marker: str) -> None: | ||
| """Require stale-error cleanup followed by one explicit missing-file verdict.""" | ||
|
|
||
| cleanup_marker = "preview.classList.remove('required-star');" | ||
| self.assertIn(cleanup_marker, handler) | ||
| self.assertLess(handler.index(cleanup_marker), handler.index(empty_marker)) | ||
|
|
||
| empty_start = handler.index(empty_marker) | ||
| empty_end = handler.index("return;", empty_start) | ||
| empty_branch = handler[empty_start:empty_end] | ||
| self.assertIn("preview.innerText = 'This field is required.';", empty_branch) | ||
| self.assertIn("preview.style.color = '';", empty_branch) | ||
| self.assertIn("preview.classList.add('required-star');", empty_branch) | ||
| self.assertIn("input.setCustomValidity('This field is required.');", empty_branch) | ||
| self.assertIn("input.setAttribute('aria-invalid', 'true');", empty_branch) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
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
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.