Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* FieldStyler: Remove classes not added by #addClassMike Gerwitz2017-03-171-4/+5
| | | | | | | | | | This code assumed that no classes would be removed that were _not_ added by #addClass. Well, that's false. * src/ui/styler/FieldStyler.js (removeClass): Consider both spaces and boundary preceding class name. * test/ui/styler/FieldStylerTest.js: Add test case.
* ValidStateMonitor: Consider scalar diff to affect all indexesMike Gerwitz2017-03-171-2/+11
| | | | | | | | | | | Classifications often yield scalar results. Since those results are used directly in the diff, we have the situation where the expected diff format (an array) is not provided. Consistent with the rest of the system, we should consider a scalar to affect every index. * src/validate/ValidStateMonitor.js (_checkCauseFix): Consider scalar diffs to affect every index when checking for fixes. * test/validate/ValidStateMonitorTest.js: Add test.
* Client: clear validation errors on dapi fieldLoadedMike Gerwitz2017-02-221-0/+6
| | | | | | | | | Previously, the system relied on the preStagingUpdate StagingBucket event to do this implicitly, but that is no longer kicked off when the diff doesn't produce any bucket changes. * src/client/Client.js (_createProgram) [dapi]: Clear validation failures on dapi fieldLoaded.
* DataApiManager: emit fieldLoaded after request completesMike Gerwitz2017-02-221-0/+4
| | | | | | | | | | | | The intent of this is to allow for clearing errors after fields load (e.g. a "field loading" message if the user attempts to continue past the step when a field hasn't yet finished loading). * src/dapi/DataApiManager.js (getApiData): Emit fieldLoaded after request completes. * test/dapi/DataApiManagerTest.js: Add test case. DEV-2299
* DataValidator: properly chain queueMike Gerwitz2017-02-211-2/+4
| | | | | | | | | This was not properly chain the promises---it was always chaining on the original _pending (so, the first request) and never clearing _pending after that point. * src/validate/DataValidator.js (_onceReady): Properly chain. * test/validate/DataValidatorTest.js: Updated test. Don't ask.
* StagingBucket: Use strict mode (and fix accidental globals)Mike Gerwitz2017-02-201-28/+32
| | | | | | | | This fixes accidental global variables and enables strict mode to prevent it in the future. * src/bucket/StagingBucket.js: Enable strict mode. Use const/let where appropriate instead of var.
* StagingBucket: Do not process non-changesMike Gerwitz2017-02-201-0/+47
| | | | | | | | | | | | | | | | | Since changes trigger any event observers---which can be expensive---it is ideal to ignore sets that do not result in any changes to the bucket. This also resolves issues with systems that are confused by empty diffs. * src/bucket/StagingBucket.js (_hasChanged): Add method. (setValues): Use it. * test/bucket/StagingBucketTest.js: Add test case. DEV-2299
* Liberate numerous bucket classesMike Gerwitz2017-02-175-4/+1132
| | | | | | | | * src/bucket/DelayedStagingBucket.js: Add class. * src/bucket/QuoteDataBucket.js: Add class. * src/bucket/StagingBucket.js: Add class. * src/bucket/StagingBucketAutoDiscard.js: Add class. * src/client/ClientDependencyFactory.js: Add class.
* DataValidator: Hold concurrent requestsMike Gerwitz2017-02-171-28/+62
| | | | | | | | | | | | | Since we maintain state (as a kluge for the time being to integrate with the rest of the system), we need to be careful to protect against concurrent requests that might mess with it before the original request is complete. * src/validate/DataValidator.js (validate, updateFailures): Hold concurrent requests. (_onceReady): Add method. * test/validate/DataValidatorTest.js: Add tests.
* Revert "DataValidator: Always clear store state"Mike Gerwitz2017-02-161-2/+1
| | | | | | | This breaks everything. :x This reverts commit e0c2e4dc861d523c40b2d35a242e48b8b7c99662, reversing changes made to e610372c8443ba5c5e73ed0791e642d82772d5cd.
* DataValidator: Queue validations when incompleteMike Gerwitz2017-02-161-2/+26
| | | | | | | | | * src/validate/DataValidator.js (validate): If a validation is ongoing, queue requests. * test/validate/DataValidatorTest.js: Add test. DEV-2299
* Program UI testing libraryMike Gerwitz2017-02-164-0/+299
|\
| * Testing utilities for stubbing ProgramMike Gerwitz2017-02-154-0/+299
| | | | | | | | | | | | | | | | | | | | This allows for testing assertions. It's fairly primitive, but will work for the time being. * src/test/README: Add file. * src/test/program/DummyClassifier.js: Add module. * src/test/program/Program.js: Add class. * src/test/program/util.js: Add module.
* | DataValidator: Always clear store stateMike Gerwitz2017-02-131-1/+2
|/ | | | | | | | | | | | | In practice, not clearing the store and allowing it to use previous state has the effect of instantly "fixing" failures if there happens to be more than one validation call. This was a log of debugging for a one-line change. * src/validate/DataValidator.js (_populateStore): Always clear store. * test/validate/DataValidatorTest.js: Add test. DEV-2299
* FieldVisibilityEventHandler: use new DataValidator APIMike Gerwitz2017-02-091-1/+1
| | | | | | | | | | | | | | I updated DataValidator but never updated the caller. Damnit. It's an unfortunate side-effect of dynamic, loosely typed languages and mitigating it requires what should be boilerplate functional tests (in this case---functional tests are useful for many other integration aspects). * src/event/FieldVisibilityEventHandler.js (handle): Use updated DataValidator#clearFailures API, which has a different descriptor format. * test/event/FieldVisibilityEventHandlerTest.js: Update test.
* Integrate field visibility event handlerMike Gerwitz2017-02-082-92/+35
| | | | | | | | | | | * src/client/Client.js (_hideField): Remove method (extracted into FieldVisibilityEventHandler). (handleEvent): Remove show/hide handling. (_handleClassMatch): Adjust to new class/API. * src/client/ClientDependencyFactory.js (createClientEventHandler): Add show/hide event handlers.
* FieldVisibilityEventHandler: Add classMike Gerwitz2017-02-081-0/+111
| | | | | | | | This extracts code from internal lovullo repo rating-fw (originally Client#_hideFields), 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e. * src/event/FieldVisibilityEventHandler.js: Add class. * test/event/FieldVisibilityEventHandlerTest.js: Add test case.
* DataValidator, ValidStateMonitor: Add #clearFailures argumentMike Gerwitz2017-02-082-29/+46
| | | | | | | | | | | | | | This allows clearing only the specified failures. * src/validate/ValidStateMonitor.js (clearFailures): Add `fields' argument. Make method more concise. (_fixFailure): Handle clearing `_failures' record. * src/validate/DataValidator.js (clearFailures): Add `fields' argument. * test/validate/ValidStateMonitorTest.js: Add test. * test/validate/DataValidatorTest.js: Add test.
* Liberate ClientDebug classesMike Gerwitz2017-02-087-0/+2139
| | | | | | | | | | | | | This is a separate program of sorts that sits alongside and hooks the Client. * src/client/debug/AssertionClientDebugTab.js: Add class. * src/client/debug/BucketClientDebugTab.js: Add class. * src/client/debug/CalcClientDebugTab.js: Add class. * src/client/debug/ClassifyClientDebugTab.js: Add class. * src/client/debug/ClientDebug.js: Add class. * src/client/debug/ClientDebugDialog.js: Add class. * src/client/debug/ClientDebugTab.js: Add interface.
* Client: Extract from internal repoMike Gerwitz2017-02-072-0/+3470
| | | | | | | | | | | | | | | | This thing is an ugly monstrosity that has witheld some pretty rough development times. As code is touched, it is being removed. This depends on many things not yet in the liza repo; they'll be added in time. These classes were changed slightly to work within liza (e.g. paths). * src/client/Client.js: Extract from rating-fw as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e. * src/client/ClientDependencyFactory.js: Extract from rating-fw as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
* UnknownEventError: use ease.jsMike Gerwitz2017-02-061-13/+5
| | | | | | ease.js supports Error extending now. * src/event/UnknownEventError.js: Use easejs.
* Liberate event handlersMike Gerwitz2017-02-068-0/+728
| | | | | These are extracted from rating-fw commit 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
* DataValidator, ValidStateMonitor: Add #clearFailuresMike Gerwitz2017-02-022-1/+75
| | | | | | | | * src/validate/DataValidator.js (clearFailures): Add public method. * test/validate/DataValidatorTest.js: Add #clearFailures test. * src/validate/ValidStateMonitor.js (clearFailures): Add public method. * test/validate/ValidStateMonitorTest.js: Add #clearFailures test.
* system.client: working data.diffStoreMike Gerwitz2017-01-301-2/+30
| | | | | | | * src/system/client.js (data.diffStore): Compose all stores. * test/system/clientTest.js: Update test case. DEV-2296
* DataValidator: accept classification resultsMike Gerwitz2017-01-301-29/+36
| | | | | | | | | | | | | * src/validate/DataValidator.js (validate): New `classes' parameter. API BC break from previous commits. (populateStore, updateFailures): Generalize methods. * test/validate/DataValidatorTest.js: Add associated test. Refactor existing tests to adhere to new API/expectations. DEV-2206
* ValidStateMonitor: handle empty diff on past failureMike Gerwitz2017-01-301-3/+2
| | | | | | | | | | | | See the description in the test case. This is a bug fix. * src/validate/ValidStateMonitor.js (_checkCauseFix): Do not consider an empty diff on a past failure to be a fix. * test/validate/ValidStateMonitorTest.js: Add test. DEV-2296
* Add DiffStoreMike Gerwitz2017-01-301-0/+293
| | | | | | | * src/store/DiffStore.js: Add class. * test/store/DiffStoreTest.js: Add test case. DEV-2296
* Update MemoryStore syntax to ES6Mike Gerwitz2017-01-301-14/+9
| | | | | | | | `#reduce` is much better. * src/store/MemoryStore.js: Update syntax. DEV-2296
* Store#clear to return selfMike Gerwitz2017-01-302-3/+5
| | | | | | | | * src/store/MemoryStore.js (clear): Promise resolve to self. * src/store/Store.js (clear): Update docblock. * test/store/MemoryStoreTest.js: Update test case accordingly. DEV-2296
* Add PatternProxy Store traitMike Gerwitz2017-01-302-0/+253
| | | | | | | | | | Life is so much less miserable now that the project is supporting ES6. * src/store/PatternProxy.js: Add trait. * src/store/StorePatternError.js: Add Error. * test/store/PatternProxyTest.js: Add test case. DEV-2296
* ES6-ify ValidStateMonitorMike Gerwitz2017-01-291-74/+50
| | | | | | | | | This also helps to demonstrate how the more concise syntax improves readability. * src/validate/ValidStateMonitor.js: Syntax to ES6. DEV-2296
* Store#add to return selfMike Gerwitz2017-01-293-11/+7
| | | | | | | | | | | | | | | This allows for Promise chaining (and consequently temporary classes, great for testing). * src/store/MemoryStore.js (add): Resolve promise to self. Modify docblock. * src/store/Store.js (add): Modify docblock. * src/store/Cascading.js (add): Modify docblock. * test/store/MemoryStoreTest.js: Modify test accordingly. DEV-2296
* Began system/ with clientMike Gerwitz2017-01-291-0/+39
| | | | | | | | | | | | | This will contain various factories (compounded in some cases) to instantiate various parts of a coherent system. It aims to replace (as one of many pieces) the ClientDependencyFactory that's referenced in the code, which is still part of rating-fw (internal LoVullo repo from which liza is being liberated). * src/system/client.js: Add module. * test/system/clientTest.js: Add functional test case. DEV-2296
* Integrate Store into DataValidator, ValidStateMonitorMike Gerwitz2017-01-292-52/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ValidStateMonitor now uses a Store in place of the original primitive object-based diff format. The original format is translated by DataValidator. The code is in a transitional state, and considering the amount of time we spend on various areas of this project, will likely stay this way for a while. * src/validate/DataValidator.js (__construct): Accept Store factory parameter. (_store_factory): Add field. (_createStores): Add method. (_validate): Handle Store. (updateFailures): Add method. (_populateStore): Add method. * test/validate/DataValidatorTest.js: Add tests. * src/validate/ValidStateMonitor.js (update): Enforce Store diff. Wait to process failures until fixes are calculated. (_checkFailureFix): Handle asynchronous, Promise-based diff. (_checkCauseFix): Extract logic from _checkCauseFix. * test/validate/ValidStateMonitorTest.js: Modify test cases to be Promise-based and handle async calls where appropriate. That was a friggin' expensive mess. DEV-2296
* Add DataValidatorMike Gerwitz2017-01-271-0/+105
| | | | | | | | | | This extracts some gross code from Client in the rating-fw repo, which is responsible for gluing change validations together. * src/validate/DataValidator.js: Add class. * test/validate/DataValidatorTest.js: Add test case. DEV-2296
* Make BucketDataValidator public methods virtualMike Gerwitz2017-01-271-2/+2
| | | | | | | | | This class is terribly factored and not tested. * src/validate/BucketDataValidator.js (validate,format): Make methods virtual. DEV-2296
* ValidStateMonitor#update return PromiseMike Gerwitz2017-01-271-30/+51
| | | | | | | | | | Stepping stone to async. fix checks. * src/validate/ValidStateMonitor.js (update, detectFixes, _checkFailureFix): Return Promise. * test/validate/ValidStateMonitorTest.js: Update to use promises. DEV-2296
* Add StoreMissErrorMike Gerwitz2017-01-042-3/+37
| | | | | | | | Nice and trivial with the new easejs transparent error subtyping! * src/store/StoreMissError.js: Add error class. * src/store/MemoryStore.js (get): Use it. * test/store/MemoryStoreTest.js (#get): Modify test to expect type.
* Add MissLookup traitMike Gerwitz2017-01-041-0/+163
| | | | | * src/store/MissLookup.js: Add trait. * test/store/MissLookupTest.js: Add test case.
* Make {,Memory}Store asynchronousMike Gerwitz2017-01-042-49/+97
| | | | | This isn't terribly useful as a general-purpose cache if it can't handle async requests.
* Add store.CascadingMike Gerwitz2017-01-031-0/+99
| | | | | * src/store/Cascading.js: Add trait. * test/store/CascadingTest.js: Add test case.
* Add {,Memory}StoreMike Gerwitz2017-01-032-0/+225
| | | | | | * src/store/Store.js: Add interface. * src/store/MemoryStore.js: Add class. * test/store/MemoryStoreTest.js: Add test case.
* Add Currency formatterMike Gerwitz2016-12-011-0/+36
| | | | * src/validate/formatter/Currency.js: Add class.
* Replace Currency formatter with StringFormatMike Gerwitz2016-12-012-75/+178
| | | | | | | | | | This is a much more general solution. * src/validate/formatter/Currency.js: Remove trait. * test/validate/formatter/CurrencyTest.js: Remove test case. * src/validate/formatter/StringFormat.js: Add trait. * test/validate/formatter/StringFormatTest.js: Add test case.
* Validate correct Number formatMike Gerwitz2016-12-011-2/+10
| | | | | | | * src/validate/formatter/Number.js (parse): Validate number format. * test/validate/formatter/NumberTest.js: Modify accordingly.
* Add scale to Number formatterMike Gerwitz2016-12-011-3/+131
| | | | | | | | | | * src/validate/formatter/Number.js (__mixin): Add mixin ctor. (parse): Handle scale. (styleNumber): Handle scale. (scale, split): Add methods. * test/validate/formatter/NumberTest.js: Modified accordingly.
* Add Currency formatterMike Gerwitz2016-11-281-0/+75
| | | | | * src/validate/formatter/Currency.js: Add trait. * test/validate/formatter/CurrencyTest.js: Add test case.
* Correct Number formatter docblockMike Gerwitz2016-11-281-1/+1
| | | | * src/validate/formatter/Number.js: Correct trait docblock.
* Correct and test GeneralStepUi#scrollToMike Gerwitz2016-08-051-4/+12
| | | | | | | | * src/ui/step/GeneralStepUi.js (scrollTo): Will now abort after each error rather than falling through. Visibility error message will now show field index. * test/ui/step/GeneralStepUiTest.js: Added respective test cases
* Accept jQuery in GeneralStepUiMike Gerwitz2016-08-051-2/+23
| | | | | | | | This defaults to the global jQuery just so we don't break everything (BC); that'll be removed in the future. * src/ui/step/GeneralStepUi.js (__construct): Accept jQuery. (setContent): Use jQuery instance passed via ctor