1
0
Fork 0
Commit Graph

102 Commits (a1c49f1d3200f2d2ae8dc25366e7261e1f184b27)

Author SHA1 Message Date
Mike Gerwitz 8d68880712 Remove multitext answer styler
This can now be handled with the existing formatters, specifically the
MultiDimension trait.  Specifically, multitext simply handled the
styling of vectors.

* src/ui/ElementStyler.js (_answerStylers): Remove multilimit
2016-07-20 15:23:35 -04:00
Mike Gerwitz d0768e20ca Remove now-unneeded answer stylers
There are more to be removed; baby steps.

* src/ui/ElementStyler.js
  (_answerStylers.{limit,multilimit,acceptReject,limitReject): Removed
2016-06-28 10:27:59 -04:00
Mike Gerwitz 5ce106710e Add MultiDimension formatter
* src/validate/formatter/MultiDimension.js: Added
* test/validate/formatter/MultiDimensionTest.js: Added
2016-06-28 10:27:59 -04:00
Mike Gerwitz 8feb8f286a Add StandardLimitFormatter
This formats according to common insurance conventions for limits.

* src/validate/formatter/insurance/StandardLimitFormatter.js: Added.
2016-06-28 10:27:59 -04:00
Mike Gerwitz b90f6d7474 Add accept/reject styler
* src/validate/formatter/AcceptReject.js: Added.
* test/validate/formatter/AcceptRejectTest.js: Added.
2016-06-28 10:27:56 -04:00
Mike Gerwitz 31f3ab010e Add Limit formatter
* src/validate/formatter/insurance/Limit.js: Added
* test/validate/formatter/insurance/LimitTest.js: Added
2016-06-27 16:51:25 -04:00
Mike Gerwitz c0df3ef02e Add Number formatter
* src/validate/formatter/Number.js: Added
* test/validate/formatter/NumberTest.js: Added
2016-06-27 16:51:25 -04:00
Mike Gerwitz 8a26406468 Add MultiDelimited formatter trait
This will simplify, through composition, a number of other
validator-formatters.

* src/validate/formatter/MultiDelimited.js: Added
* test/validate/formatter/MultiDelimitedTest.js: Added
2016-06-27 16:51:17 -04:00
Mike Gerwitz 4aa88fc08c UnorderedList{Formatter=>} now a trait
This adds a great deal of flexibility through composition via trait
stacking.

* src/validate/formatter/UnorderedList.js: Renamed from
  UnorderedListFormatter; now a trait.

* test/validate/formatter/UnorderedListTest.js: Renamed from
  UnorderedListFormatterTest and adjusted to instantiate trait.
2016-06-24 15:57:10 -04:00
Mike Gerwitz ac52f42d1c Add EchoFormatter
* src/validate/formatter/EchoFormatter.js: Added.
* test/validate/formatter/EchoFormatterTest.js: Added.
2016-06-23 10:12:59 -04:00
Mike Gerwitz 391a819536 Liberated UnorderedListFormatter
These have been refacored from the original: rather than abusing what is now
the PatternFormatter, it is now its own class.

* src/validate/formatter/UnorderedListFormatter.js: Added.
* test/validate/formatter/UnorderedListFormatterTest.js: Added.
2016-06-23 09:14:05 -04:00
Mike Gerwitz d6cecf1ff6 VFormat => PatternFormatter with added interface
* src/validate/ValidatorFormatter.js: Interface added.
* src/validate/formatter/PatternFormatter.js: Renamed from ../VFormat.js.
* test/validate/formatter/PatternFormatterTest.js: Renamed from
  ../VFormatTest.js.
2016-06-22 15:59:12 -04:00
Mike Gerwitz a509e53a3e Liberate VFormat
This will likely undergo some refactoring.

* src/validate/VFormat.js: Added.
* test/validate/VFormatTest.js: Added.
2016-06-22 15:41:03 -04:00
Mike Gerwitz 2a6b170ac9 Remove unneeded answer stylers
These all have VFormat alternatives.

* src/ui/ElementStyler.js (_answerStylers): Removed
2016-06-21 16:46:21 -04:00
Mike Gerwitz f5549795d5 GeneralStepUi vformat styling
* package.json (devDependencies): Add sinon

* src/ui/step/GeneralStepUi.js (answerDataUpdate): Attempt formatting with
  formatter prior to "old" answer styling.

* test/ui/step/GeneralStepUiTest.js: Added
2016-06-21 16:46:05 -04:00
Mike Gerwitz 91903951c4 Extract direct answer context references into method
This allows overriding for testing (and is a proper abstraction); eventually
this will be moved out of this class entirely.

* src/ui/step/GeneralStepUi.js (getAnswerContext): Added
  Number of methods updated to use.
2016-06-20 10:29:44 -04:00
Mike Gerwitz 7a1e1a68e3 GeneralStepUi answer styling method extraction
This is just to enable some sort of testing without instantiating the entire
class and navigating a maze of methods.

* ui/step/GeneralStepUi.js (answerDataUpdate): Added
  (_processAnswerFields): Extracted function into answerDataUpate
2016-06-17 14:44:49 -04:00
Mike Gerwitz e6ede4ad3a ValidStateMonitor: merge subsequent failures before fixes
* src/validate/ValidStateMonitor.js (mergeFailures):
Another error on a field that previously failed will no longer overwrite the
previous failure, which caused issue when the causes changed (leaving fields
potentially unfixed).

* test/validate/ValidStateMonitorTest.js: Respective tests added.
2016-04-28 11:53:14 -04:00
Mike Gerwitz e406c198d2 Add Failure#merge
* src/validate/Failure.js (merge): Added
* test/validate/FailureTest.js: Respective tests added
2016-04-28 11:31:42 -04:00
Mike Gerwitz b3d3f4b7cd Remove support for string-style validation failures
* src/validate/ValidStateMonitor (_getCauses): Removed
Now requires that each failure be a Failure object.
2016-04-21 16:28:34 -04:00
Mike Gerwitz 0a8329b405 Support multiple validation failure causes
* src/validate/Failure.js (__construct): Takes an array of causes.
(getCauses): Now returns an array of causes.

* src/validate/ValidStateMonitor.js: Recognize fixes on array of causes.

* test/validate/FailureTest.js: Updated

* test/validate/ValidStateMonitorTest.js: Updated
2016-04-21 16:23:41 -04:00
Mike Gerwitz f624710451 Consider field failure cause when checking fixes
This maintains BC with the old string-based system.

* src/validate/ValidStateMonitor.js (_getCause): Added.
(detectFixes): Consider failure cause if available when checking for fixes.
2016-04-20 12:11:17 -04:00
Mike Gerwitz ac5d04e9a4 Add validation Failure
* src/validate/Failure.js: Added
* test/validate/FailureTtest.js: Added
2016-04-20 10:31:49 -04:00
Mike Gerwitz ddffb4e301 No failure event if failures have not changed in ValidStateMonitor
* src/validate/ValidStateMonitor.js (mergeFailures): Return count of new
failures

* test/validate/ValidStateMonitorTest.js: Respective test added
2016-04-19 11:29:14 -04:00
Mike Gerwitz 3a2a5642b6 Add FlatGroupUi
This solves the problem of trying to show/hide indexes that do not even
exist on the DOM.

There are no tests for this due to the complexity of the parent; refactoring
is needed. :(

* src/ui/group/FlatGroupUi: Added
2016-04-19 10:51:15 -04:00
Mike Gerwitz fcce2e814a Fields with index greater than total in group are not visible
* src/ui/group/GroupUi (isFieldVisible): Indexes greater than the current
index count will no longer be considered to be visible.
2016-04-19 10:50:32 -04:00
Mike Gerwitz 6d51dc55eb Add DataApiManager field stale flag
This will allow it to know when a request needs to be re-made at a later
time.

* src/dapi/DataApiManager (fieldStale, isFieldStale): Added
(fieldNotReady): Check stale status of field
2016-04-15 12:24:08 -04:00
Mike Gerwitz 3e84f18c56 Extract Data API management into DataApiManager
This is extracted from a not-yet-liberated Program class (that you really
don't want to see).

* src/dapi/DataApiManager.js: Added
2016-04-15 12:23:31 -04:00
Mike Gerwitz d37a8aab12 Liberate dapis
* src/bucket/Bucket.js: Added
* src/dapi/BucketDataApi.js: Added
* src/dapi/RestrictedDataApi.js: Added
* src/dapi/StaticAdditionDataApi.js: Added
2016-04-14 13:53:35 -04:00
Mike Gerwitz a6115018d2 Add x-www-form-urlencoded header for XhrHttpImpl
It might be the case that we may want to post raw data in the future; in
fact, I can guarantee it.  We'll cross that bridge when we come to it.

* src/dapi/http/XhrHttpImpl.js (openRequest): Set ContentType header
on POST

* test/dapi/http/XhrHttpImplTest.js: Modified accordingly
2016-04-14 12:08:00 -04:00
Mike Gerwitz bc0d230246 Remove trailing comma from ValidStateMonitor
Yes, the reason is IE.

* src/validate/ValidStateMonitor.js: Remove trailing comma after method
definition list.
2016-04-13 08:27:16 -04:00
Mike Gerwitz 9dfc7c04ff Remove ClientFieldValidator
Use ValidStateMonitor instead.

* src/validate/ClientFieldValidator.js: Deleted
2016-04-12 14:06:57 -04:00
Mike Gerwitz 659c820eb6 Add ValidStateMonitor
The intent is to ultimately replace ClientFieldValidator with this and
individual validators that interact with it.

* src/validate/ValidStateMonitor.js: Added
* test/validate/ValidStateMonitorTest.js: Added
2016-04-12 13:57:34 -04:00
Mike Gerwitz 88313c016e Accept full bucket data for ClientFieldValidator#validate
This allows #validate to be used generically for any type of validation, not
just change events.

* src/validate/ClientFieldValidator.js (validate):
Accept and propagate all bucket data to `validate` event listeners.
2016-04-11 11:53:45 -04:00
Mike Gerwitz fefe2dae41 Remove ClientFieldValidator#monitor
* src/validate/ClientFieldValidator.js (monitor): Remove
This just concerns itself with something that it should be concerned about;
let the caller handle monitoring, now that we have a #validate method.
2016-04-11 11:50:27 -04:00
Mike Gerwitz 0ac16a3505 Add ClientFieldValidator#validate
* src/validate/ClientFieldValidator (validate): Added
Extracted logic that previously was exclusive to #monitor; that method will
now simply invoke #validate.
2016-04-11 11:29:34 -04:00
Mike Gerwitz 6f17e704a6 Liberate {ClientField,BucketData}Validator
* src/validate/BucketDataValidator.js: Added
* src/validate/ClientFieldValidator.js: Added
2016-04-11 11:18:18 -04:00
Mike Gerwitz bada152d52 {Error=>DomFieldNotFound} error when DOM field is not found
* src/ui/field/DomField.js (queryElement): {Error=>DomFieldNotFoundError}
when a DOM element cannot be located for the field.

* src/ui/field/DomFieldNotFoundError.js: Added
2016-04-06 10:44:11 -04:00
Mike Gerwitz a145bfe1f8 Use HTMLElement#setAttribute in NaFieldStyler for IE<9
element.style is not supported as an lvalue in IE<9.

All the rest of the sane world that doesn't support IE<9 should be laughing
at me in pity right now.

* src/ui/styler/NaFieldStyler.js (hideField):
Use HTMLElement#setAttribute instead of HTMLElement#style as an lvalue

* test/ui/styler/NaFieldStylerTest.js: Modify test cases to check for
invocation of setAttribute
2016-04-05 11:53:30 -04:00
Mike Gerwitz c29b935f5c NaFieldStylerAnimation properly re-show element in IE
* src/ui/styler/NaFieldStylerAnimation (showField):
The 'display:none' style was retained in certain circumstances after
animation in IE; this fixes that.
2016-04-05 08:59:43 -04:00
Mike Gerwitz 921880cb35 {Tabbed,}GroupUi now show/hide using FieldStyler
Yes, this is a mess; I'm pretty much out of time now.

* src/ui/group/GroupUi.js (doShowField, doHideField):
Use field styler

* src/ui/group/TabbedGroupUi (doShowField, doHideField):
Defer to supertype
2016-04-05 00:07:26 -04:00
Mike Gerwitz d8fc549700 DomFieldFactory falls back to element lookups by id
* src/ui/field/DomFieldFactory (create):
Use ElementStyler#getElementByNameLax
2016-04-05 00:05:07 -04:00
Mike Gerwitz afa14ccc39 Add ElementStyler#getFieldByNameLax
Not that I want to keep adding to this monstrosity; no time to refactor
right now.

* src/ui/ElementStyler.js (getFieldByNameLax): Added
2016-04-05 00:03:47 -04:00
Mike Gerwitz 1e332a5a72 Add NaFieldStylerAnimation
I didn't really want to add this back in, but others in the group
thought that change might be bad for users.  This animation thing is
just so sloppy, I think.

* src/ui/styler/NaFieldStylerAnimation.js: Added
2016-04-05 00:01:08 -04:00
Mike Gerwitz befca68110 Extract NaFieldStyler show/hide actions into protected methods
* src/ui/styler/NaFieldStyler.js (showField, hideField): Added
* test/ui/styler/NaFieldStyler.js: Added respective tests
2016-04-04 23:59:57 -04:00
Mike Gerwitz e1c2194962 DomField will now consider that field element might have changed on DOM
This solves styling and DOM mutation issues.  For now.

* src/ui/field/DomField.js (queryElement, updateElement): Added
(_getElement): Extracted into queryElement and updated to re-query DOM each
time, returning last match if not found.
(applyStyle, revokeStyle): Defers style applied predicate to style itself
2016-04-04 15:35:43 -04:00
Mike Gerwitz 40505c3328 FieldStyler#isApplied added
Field stylers now determine whether they've been applied to the target field
on their own, which solves the problem of the system getting out of sync.

* src/ui/styler/ErrorFieldStyler.js (isApplied): Added
* src/ui/styler/FieldStyler.js (isApplied): Added
* src/ui/styler/NaFieldStyler.js (isApplied): Added
* test/ui/styler/NaFieldStylerTest.js: Test for #isApplied
2016-04-04 15:25:52 -04:00
Mike Gerwitz ae9f2a7cab NaFieldStyler remove subfields from DOM
This is necessarily primarily for a specific case: option elements in IE,
which cannot be styled. >:O

This implementation is not complete: we want to re-attach the field at the
same position it was at before it was detached.  This might not be
trivial---imagine if its sibling was also detached.

* src/ui/styler/NaFieldStyler.js (isSubField): Receive field instead of
element (to check parent)
(applyStyle, revokeStyle): Detach and re-attach field from/to DOM
respectively

* test/ui/styler/NaFieldStylerTest.js: Associated tests
2016-04-04 12:30:21 -04:00
Mike Gerwitz 782e4832af Cache DomField parent element
* src/ui/field/DomField.js (getParentElement):
Renamed from getParent.  Cache parent element in memory so that we have a
reference for re-attaching fields to the DOM.
(getParent): Public API addition; call getParentElement
2016-04-04 12:30:21 -04:00
Mike Gerwitz fa37850408 Proper NaFieldStyler sub-field hiding support
* src/ui/styler/NaFieldStyler.js (_isSubField): Added
(applyStyle, revokeStyle): Will not hide parents of sub-fields
2016-04-04 12:30:21 -04:00