1
0
Fork 0
Commit Graph

451 Commits (master)

Author SHA1 Message Date
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
Mike Gerwitz 064fcd00fd Abort TabbedGroupUi hide when deferred
* src/ui/group/TabbedGroupUi.js (doShowField, doHideField):
Return from method after setting deferred operation.  This previously
did not fail because jQuery didn't care if operations are not
performed on field matches.
2016-04-04 12:30:05 -04:00
Mike Gerwitz eb073f5db0 DomField#getParent proper nodeName comparison
* src/ui/field/DomFieldFactory (getParent): Convert parent nodeName to
uppercase before comparison (it might not always be)
2016-04-04 11:17:14 -04:00
Mike Gerwitz edbc45a79b DomField#getContainingRow handling of direct row reference
* src/ui/field/DomField.js (getContainingRow): Return self if DT or DD

Certain types of elements (e.g. statics) are compiled such that the direct
reference is the row itself.
2016-04-04 11:17:14 -04:00
Mike Gerwitz c204a12c19 Add NaFieldStyler
* src/ui/styler/NaFieldStyler.js: Added
* test/ui/styler/NaFieldStylerTest.js: Added
2016-04-04 11:17:12 -04:00
Mike Gerwitz 4cce3759db Rename method todo on DomContext#_dequeue
* src/ui/context/DomContext.js (_dequeue): Add todo
2016-04-02 00:30:42 -04:00
Mike Gerwitz d126f618ae Add FieldStyler docblocks
* src/ui/styler/FieldStyler.js (getId, applyStyle, revokeStyle,
addClass, removeClass): Docblocks added
2016-04-02 00:30:42 -04:00
Mike Gerwitz a3b16f33c9 Liberate ui/styler/
* src/ui/styler/ErrorFieldStyler.js: Added
* src/ui/styler/ErrorStyler.js: Added
* src/ui/styler/FieldStyler.js: Added
* src/ui/styler/SidebarErrorStyler.js: Added
* src/ui/styler/StepErrorStyler.js: Added
* src/ui/styler/Styler.js: Added
2016-04-02 00:30:42 -04:00
Mike Gerwitz 37c74eac48 ElementStyler.js (__construct): Decouple jQuery instance 2016-04-02 00:30:42 -04:00
Mike Gerwitz fea4e151cc Liberated archaic DOM element styler
* src/ui/ElementStyler.js: Added

* src/sort/MultiSort.js: Removed ElementStyler liberation todo
* src/ui/field/DomFieldFactory.js: Same
* src/ui/step/GeneralStepUi.js: Same
* src/ui/step/StepUiBuilder.js: Same

This existed when the framework was very long, and has managed to survive
numerous refactoring attempts; it used to be a small class abstracting
element styling, and it has had crap thrown into it ever since, partially
due to time constraints.  It needs to go away.
2016-04-02 00:30:11 -04:00
Mike Gerwitz 003d527307 Liberate context/
* ui/context/Context.js: Added
* ui/context/DomContext.js: Added
* ui/context/DynamicContext.js: Added
* ui/context/RootDomContext.js: Added
2016-04-01 16:03:52 -04:00
Mike Gerwitz 2fa20c9864 Group support for showing/hiding sub-fields
* src/ui/GroupUi.js (getFieldElements): New method
(showField, hideField): Use GroupUi#getFieldElements

* src/ui/group/TabbedGroupUi (showField, hideField):
Use GroupUi#getFieldElements
2016-03-30 14:16:27 -04:00
Mike Gerwitz 6ab3842015 Proper attribution for src/version.js.in 2016-03-29 14:35:59 -04:00
Arthur Domino 93bff03676 Do not collapse CollapseTableGroups when created. 2016-03-29 09:58:26 -04:00
Mike Gerwitz c56d6ac7b2 GeneralStepUi#_sortGroups: correct group sorting
The modified parent was not the parent of groups, so the group DOM operations failed.
2015-12-04 10:03:52 -05:00
Mike Gerwitz 1a3dd236f8 GeneralStepUi#_sortGroups: maintain DOM order after group sorting
This was affected by 4ce78ebd9e.
2015-12-03 08:27:59 -05:00
Mike Gerwitz a60bf6b52e Liberated Group and its various UIs
The `AccordionGroupUi` was not liberated, because it is my intent to
eliminate it---I did not agree with its needless addition to begin with.  If
we do end up keeping it, then it will be liberated as well.
2015-12-03 00:36:31 -05:00
Mike Gerwitz 3d9780c39e {=>General}StepUi; StepUi interface
This allows us to begin development (and testing) of StepUi subtypes without
having to worry about the convoluted crap that GeneralStepUi is doing.
Specifically, all the jQuery stuff needs to go.
2015-12-03 00:11:53 -05:00
Mike Gerwitz cc21298297 StepUi: Accept and return vanilla DOM content
This encapsulates the use of jQuery which will eventually be entirely
eliminated.
2015-12-03 00:11:53 -05:00
Mike Gerwitz 972856225b Extract StepUi#detach
You can't see where this is going, because there is other code that is not
yet part of Liza.  ...sorry.
2015-12-03 00:11:52 -05:00
Mike Gerwitz 4ce78ebd9e StepUiBuilder do not enclose groups in parent element
This allows the caller to handle how to group and render steps.  But we do
add another container to hold each of the groups.
2015-12-03 00:11:52 -05:00
Mike Gerwitz 44323a0b59 Liberated StepUiBuilder 2015-12-03 00:11:52 -05:00
Mike Gerwitz 9a1dd337eb Liberate {,ui/}field/ 2015-11-30 14:38:42 -05:00
Mike Gerwitz 4cc240e977 Liberate Step 2015-11-30 13:40:33 -05:00
Mike Gerwitz f9b3fa0622 Liberate MultiSort
Step dependency.
2015-11-30 13:40:26 -05:00
Mike Gerwitz 1c4554dd0d Minor StepUi cleanup 2015-11-30 11:57:10 -05:00
Mike Gerwitz 215869e1ea Liberate StepUi
This has a lot of rough code in it, much of which I do not approve of.  But
it'll never be liberated if I make everything pristine beforehand!
2015-11-30 11:37:41 -05:00
Mike Gerwitz 5c2c468183 ECMAScript 3 compatibility fixes
This is crazy, but LoVullo Associates still supports browsers as far back as
IE7, meaning that we need to maintain ES3 support; that will hopefully
change soon.
2015-05-31 23:51:08 -04:00
Mike Gerwitz a383a36bfc HttpDataApi#request permits null data 2015-05-29 12:45:02 -04:00
Mike Gerwitz 0599acc23a Key-value param encoding moved from XhrHttpImpl to HttpDataApi 2015-05-29 12:22:26 -04:00
Mike Gerwitz f122d85938 XhrHttpImpl modify URL for GET request params and encode key-value
Some of this may be more appropriate to move out of XhrHttpImpl into
something like HttpDataApi...
2015-05-29 09:35:21 -04:00
Mike Gerwitz 881e740bb9 JsonResponse returns parse error or combined request/parse on failure 2015-05-28 15:15:41 -04:00
Mike Gerwitz ca68d12370 XhrHttpImpl no longer modifying response text
Status code included with error object
2015-05-28 15:15:41 -04:00
Mike Gerwitz 8f9b8f779f JsonResponse retain output value on request error 2015-05-28 15:15:41 -04:00
Mike Gerwitz e8344e36bb dapi.format.JsonResponse response text output value on parse failure 2015-05-28 15:15:41 -04:00
Mike Gerwitz 1669f9eeda XhrHttpImpl#request invokes XHR send
This should have always been the case; I am not sure what I was thinking,
considering that the object is encapsulated.
2015-05-28 15:15:39 -04:00
Mike Gerwitz 76280b0cac AutoRetry distinction between predicate truth and request failure 2015-05-28 15:03:50 -04:00
Mike Gerwitz 2b92a2c447 JsonResponse#request must be virtual
To suppor trait stacking.
2015-05-28 15:03:48 -04:00
Mike Gerwitz af4a775155 AutoRetry delay implementation 2015-05-27 15:25:43 -04:00
Mike Gerwitz ca5d064455 AutoRetry trait initial implementation 2015-05-27 15:25:42 -04:00
Mike Gerwitz 8fbd4dd220 XhrHttpImpl#serveError 2015-05-12 16:32:49 -04:00
Mike Gerwitz d4328968e8 XhrHttpImpl considers any 2xx status to be successful 2015-05-12 16:32:49 -04:00
Mike Gerwitz 6cc260b443 XhrHttpImpl#isSuccessful determines HTTP response success
May be overridden by subtypes.
2015-05-12 16:32:48 -04:00
Mike Gerwitz b4ef6439e9 JsonDataApi=>JsonResponse trait
This cuts down on the code significantly and makes more sense, since we
would not want to veil the API of any classes that want to use this.
2015-05-12 16:32:43 -04:00
Mike Gerwitz 0e9c511117 HttpDataApi.request is now virtual
Will support mixins
2015-05-12 13:45:19 -04:00
Mike Gerwitz 0a07ad4982 Added JsonDataApi 2015-05-12 13:45:19 -04:00
Mike Gerwitz 6d0acf5916 Initial XhrHttpImpl implementation 2015-05-12 13:45:19 -04:00
Mike Gerwitz e0f1c600ba Began liberating DataApi
The Data API is being heavily refactored and tested; while moving files into the
Liza repository, I noticed some inefficiencies with the design. These are being
heavily improved upon.
2015-05-12 13:45:19 -04:00
Mike Gerwitz 6149649327 jQuery dependency injected into GroupUi 2015-05-01 14:20:13 -04:00
Mike Gerwitz 0fe2df4de3 License header added to GroupUi 2015-05-01 14:20:13 -04:00
Mike Gerwitz ab34cc89b0 GroupUi needs love (cleanup, testing, etc) 2015-05-01 14:20:11 -04:00
Mike Gerwitz 35e1494b9c Extract GroupUi from internal repository
Verbatim.
2015-05-01 11:10:49 -04:00
Mike Gerwitz a76fd811ed Added version.js 2014-01-17 01:20:30 -05:00