-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use input widget state to style task inputs (#5091)
* Use input widget state to style task inputs Use checkbox/radio button state (active, checked or focussed) to control the style of adjacent task labels. Remove onFocus(), onBlur(), unfocus() and associated tests from TaskInputField. * Remove unused props Remove a ref that's no longer used, and a label prop that didn't seem to be referenced anywhere. Move classname up to the container label. * Convert TaskInputField to a function Convert task input field to a functional component and add React.memo to speed up rendering. Remove onChange() method and update tests. * Fix multiple choice task tests Rewrite tests to use shallow rendering and test props of the generic task component, not nested children. * Fix single answer task tests Rewrite tests to use shallow rendering and test props of the generic task component, not nested children. * Add checked prop Remove shouldInputBeChecked and move responsibility for checked logic up to parent task. Add boolean checked prop. Use defaultChecked instead of checked, so that checkbox state controls the annotation, rather than vice-versa. * Add autoFocus prop Remove shouldInputBeAutoFocussed. Add boolean autoFocus prop instead, and move autofocus logic up to parent tasks. * Fix text highlighter buttons Use the as prop to changed the rendered HTML element. Apply hover styles directly to task input labels. * Restore missing active and focus hover styles Restore styles for active state (input:checked), input checked and focussed, and label hover on checked imputs. * Define common hover styles Move common hover styles into a shared object. * Define constants for styles Define constants for the default, hover and checked themed styles. * Fix linter warnings * Update sinon spy tests Use the BDD syntax from sinon-chai.
- Loading branch information
1 parent
74a3e43
commit f2ecaf2
Showing
9 changed files
with
163 additions
and
323 deletions.
There are no files selected for viewing
This file contains 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.