Skip to content

test: add unit tests for TimeField and DateField components#11

Merged
knep merged 1 commit into
masterfrom
feat/timefield-tests
May 28, 2026
Merged

test: add unit tests for TimeField and DateField components#11
knep merged 1 commit into
masterfrom
feat/timefield-tests

Conversation

@knep
Copy link
Copy Markdown
Owner

@knep knep commented May 28, 2026

Summary

  • 21 unit tests for TimeField.vue (the new time parameter type added in PR feat: add time parameter type and HTTP security headers #1)
  • 21 unit tests for DateField.vue (the date parameter type added previously)
  • Each suite covers: config rendering, value binding, user interaction, and validation

Test coverage

Category Tests
Config label text, input type, required attr, disabled attr, label active class
Values initial display, external prop update, user @change event
Validation required/empty → error, null → error, value present → no error, error clears, disabled overrides required, data-error attribute

Implementation note

Tests use element.value = '...' + trigger('change') instead of Vue Test Utils setValue(). This is because setValue triggers a synthetic input event first (which causes Vue to re-render and reset :value back to the prop), then triggers change — so the component reads the old value. Setting element.value directly before trigger('change') avoids this re-render race.

🤖 Generated with Claude Code

42 tests covering config (label, input type, required, disabled), values
(initial display, external update, user change via @change event), and
validation (required/empty, null, disabled override, data-error attribute).

Note: tests use element.value + trigger('change') instead of setValue()
because Vue re-renders between the synthetic input/change events in setValue
and resets the bound :value, preventing the component from reading the new value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@knep knep merged commit 07347dc into master May 28, 2026
5 checks passed
knep pushed a commit that referenced this pull request May 29, 2026
Upgrades the web frontend from Vue 2 (Vue CLI + Webpack + Karma) to Vue 3 with
Vite and Vitest. Integrates cleanly with PRs #11#13 already on master (the new
DateField/TimeField unit tests were migrated to Vitest as part of this merge).

- Vue 3: v-model refactor, emits, lifecycle renames, Proxy reactivity (no more
  Vue.set/$set/$delete), :deep() selectors, Vue Router 4 + Vuex 4
- Vite build (assets in web/assets/; server web-build check updated)
- Vitest + jsdom: 821 passing, 54 browser-only skips
- Runtime bugs fixed: ace file-loader, v-if/v-for same element, reactive-Proxy
  identity (file dialog), array delete (param list), stale value-prop bindings
  (ScriptConfigForm, TimeField, DateField labels)
- Removed vue.config.js / babel.config.js / Karma entry; CI cleanup
- Verified in-browser: main + admin apps render with zero console errors

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant