Skip to content

fix: resolve state management bug and add test coverageFix/bug1 state management#4

Open
ChuhengYu22 wants to merge 8 commits intosptin2002:mainfrom
hnw-k:fix/bug1-state-management
Open

fix: resolve state management bug and add test coverageFix/bug1 state management#4
ChuhengYu22 wants to merge 8 commits intosptin2002:mainfrom
hnw-k:fix/bug1-state-management

Conversation

@ChuhengYu22
Copy link
Copy Markdown

Summary

  • Fixed Bug 1: seats were stored as DOM elements instead of ID strings
  • Fixed removeReservedSeat: splice(-1,1) deleted wrong seat when ID not found
  • Fixed updateOrderDetails to work with ID strings
  • Clear reserved seats when switching/adding/updating/deleting services
  • Added Jest unit tests for Service class (95%+ coverage)

Files Changed

  • script/seat-booking-app.js: bug fixes
  • script/Service.js: extracted Service class with module.exports
  • tests/Service.test.js: 20 unit tests
  • babel.config.js: Jest/Babel config
  • package.json: added Jest configuration

Test Coverage

  • Statements: 95.83%
  • Branches: 100%
  • Functions: 93.33%
  • Lines: 95.65%

hnw-k and others added 8 commits April 26, 2026 11:01
…e/Lighthouse critical issue)

Fixes the accessibility issue where form elements (#services-list, #service-name, #service-price) lacked associated labels. Modified index.html by adding explicit <label> elements with for attributes. This addresses the "Form elements must have labels" and "Select element must have an accessible name" violations detected by axe DevTools.
Defect 1: Add accessible labels for select and input elements (axe/Lighthouse critical issue)
…sector price inputs

Fix sector price inputs:  
- Replace invalid id `price-[object Object]` with `price-{sectorName}`  
- Add explicit `<label>` for each input to meet WCAG 4.1.2  

Now all dynamically generated form controls have proper accessible names.
Fix: Add accessible labels and correct IDs for dynamically generated sector price inputs
Add <main> tag as the main landmark to improve screen reader navigation and comply with Lighthouse best practices.

This change replaces the outer <div id="seat-booking-app"> with <main id="seat-booking-app"> and updates the closing tag accordingly. No functional changes.
Improve Lighthouse best practices score by adding main landmark
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.

2 participants