mengw15 opened a new issue, #7962:
URL: https://github.com/apache/texera/issues/7962
### Task Summary
`texera-login.component.html` is at **61.4 % with 13 uncovered lines and 9
half-taken branches** — the lowest-covered template left in the dashboard. Its
spec has 23 `it()` blocks but calls `detectChanges()` only twice, so the login
form is almost never rendered: the sign-up mode, the password-visibility toggle
and the auth-provider feature flags all sit on their unrendered side. The spec
does **not** call `TestBed.overrideComponent`, so template coverage attributes
normally and the gap is genuinely reachable.
Pure EXTEND. Vitest/jsdom; see `frontend/TESTING.md` and
`frontend/AGENTS.md`.
### Behavior to add
**Login template**
(`frontend/src/app/hub/component/login/texera-login.component.html`, codecov
61.4 % — EXTEND `texera-login.component.spec.ts`)
The mechanics throughout: set the flag or state, call
`fixture.detectChanges()`, then query with
`fixture.debugElement.query(By.css(...))` and assert what rendered — firing
events with `.triggerEventHandler(...)` rather than calling handlers on the
instance.
- **Auth-provider flags** (33, 43, 57) — the template is gated by `@if
(config.env.localLogin)` and `@if (config.env.googleLogin)`. Render with each
flag on and off and assert the corresponding block appears or is absent. Both
flags are read twice (33 and 57 for local login), so cover the combinations
rather than a single on/off pair.
- **Sign-in / sign-up mode** (35, 36, 73–116, 127) —
- the tab binding `[nzSelectedIndex]="mode === 'signin' ? 0 : 1"` and
`(nzSelectedIndexChange)="setMode($event === 0 ? 'signin' : 'signup')"`: fire
the tab change for both indices and assert `mode` flips accordingly;
- the two `@if (mode === "signup")` blocks (73, 98) that add the extra
sign-up input groups and the password-policy hint *"Password must be at least 6
characters…"* (110–116). Render in both modes and assert those elements appear
only in sign-up;
- the submit label `{{ mode === "signup" ? "Sign up" : "Sign in" }}` (127)
in both modes.
- **Password visibility** (91, 104, 138) — `[type]="passwordVisible ? 'text'
: 'password'"` on both password inputs and `[nzType]="passwordVisible ? 'eye' :
'eye-invisible'"` on the toggle icon. Click the toggle and assert the input
`type` and the icon `nzType` change on both fields.
- **Form submission** (61) — `(ngSubmit)="submit()"`; submit the rendered
form and assert `submit` ran, rather than calling it directly.
Determinism notes:
- Stub the auth/user service and the config service; provide `config.env` as
a plain object per test so flags are set explicitly and never inherited from a
shared default.
- Never perform a real login request — `HttpClientTestingModule` and flush
synchronously, or `of(...)`.
- `fixture.destroy()` in `afterEach` so subscriptions stop, and
`vi.restoreAllMocks()` so spies do not leak.
- No layout or geometry assertions — assert on attributes and presence, not
on measured size.
Note open PRs touch this component (#7664 adds ORCID login, #7600 and #7641
add demo-video content), which will add further provider branches — rebase
before finishing and assert on the flags this file has today rather than on an
exhaustive provider list.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]