Commit Graph

27 Commits

Author SHA1 Message Date
Antonio Scandurra
b7a421eadf Stop calling initialize in ViewRegistry tests 2017-05-05 09:29:29 +02:00
Nathan Sobo
a0c84d592a Remove ViewRegistry.pollDocument
Supporting it via mutation observers has a bad impact on frame rate.
2017-05-03 14:21:24 +02:00
Antonio Scandurra
ea440148d8 Fix remaining tests 2017-03-12 11:57:16 +01:00
joshaber
d929543aa2 Test for getElement. 2016-03-01 10:56:03 -05:00
Max Brunsfeld
91b651e86c Make model constructor argument to addViewProvider optional 2015-11-19 15:54:47 -08:00
Nathan Sobo
1aefb22789 Add ViewRegistry.prototype.getNextUpdatePromise
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2015-11-09 00:35:18 -07:00
Nathan Sobo
8f7c9cd370 Don’t use jQuery in view-registry-spec 2015-09-18 20:48:47 -06:00
Thomas Johansen
22ca33a3b1 Extend ViewRegistry with support for objects with an element property
By adding this extension to ViewRegistry::getView we're paving the way for
Etch-like view frameworks which promotes the usage of plain objects and
classes with an element property which is an instance of HTMLElement.
2015-08-18 21:38:00 +02:00
Nathan Sobo
c18db48f54 Fix specs 2015-07-23 12:03:20 -06:00
Nathan Sobo
92f1a800e2 Unfocus spec 2015-07-23 12:03:11 -06:00
Nathan Sobo
2869d66de0 Trigger polling in spec via window resize instead of advancing clock 2015-07-23 10:51:11 -06:00
Jessica Lord
96874d68d8 Run polling functions when windows resizes 2015-07-23 10:51:11 -06:00
Jessica Lord
fb7304a3d7 Remove event listeners after each test 2015-07-23 10:51:10 -06:00
Jessica Lord
39749ac70a Remove unused spy for intervals 2015-07-23 10:51:10 -06:00
Jessica Lord
2f11b86a34 Ensure document polling functions run when stylesheets change 2015-07-23 10:51:10 -06:00
Jessica Lord
3715e05bed Change spec to test on DOM mutation rather than interval 2015-07-23 10:51:10 -06:00
Nathan Sobo
76a919f8b4 Perform document updates in same frame when requested from reads
A common pattern is to put something on the DOM, measure it, then update
the DOM again based on that measurement. This change ensures that any
updates requested as a result of reading from the DOM get scheduled for
the end of the current frame. If you want to read *again* after these
follow-on updates, you will need to wait for the next frame. But at
least this way we ensure instant feedback with minimal thrashing
(1 reflow) when we have no choice but to read the DOM before updating.

/cc @benogle
2015-04-20 22:01:36 -06:00
Ben Ogle
32572c0106 Add ViewRegistry::pollAfterNextUpdate
Closes #6196
2015-04-01 17:41:00 -07:00
Nathan Sobo
32d393d26f Pause polling when updates are requested, but don’t start polling over
The blinking cursor was ensuring that we never polled in certain cases.
We need to allow the interval to continue polling at a normal pace, but
just avoid doing any work that could delay the next animation frame.
2015-02-20 09:51:11 -07:00
Nathan Sobo
de4d995190 Add document coordination methods to ViewRegistry
These will assist in updating and reading the DOM in a non-blocking
manner across components.
2015-02-19 17:14:57 -07:00
Nathan Sobo
e192922f0e Don’t add __spacePenView property to jQuery objects in ViewRegistry
This property is added as needed in our legacy SpacePen views, and is
now used to trigger a deprecation warning. We don’t want to add it to
new SpacePen views because they shouldn’t trigger deprecation warnings.
2015-01-02 12:58:49 -07:00
Nathan Sobo
9a9347e3a5 Simplify ViewRegistry::addViewProvider API
It now takes two arguments, a model constructor and a create view
callback that is passed the model.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-12-01 17:53:03 -08:00
Nathan Sobo
d344adc21e Allow view providers to specify a createView factory method
If present, it will be called with the model object instead of
instantiating the view constructor directly and assigning a model on it.
This gives users more flexibility when constructing views.
2014-09-19 16:24:13 -06:00
Nathan Sobo
74d772f069 Rename view/modelClass to view/modelConstructor in view provider specs
It’s a more technically correct term. You use a class keyword to declare
these things, but the actual objects you pass around to talk about them
are constructor functions.
2014-09-19 16:24:13 -06:00
Nathan Sobo
e2e804483f Return disposable from ViewRegistry::addViewProvider 2014-09-19 16:24:13 -06:00
Nathan Sobo
b5499247b3 Use view providers to build views if a matching provider is available 2014-09-19 16:24:13 -06:00
Nathan Sobo
54378b11d4 Isolate ViewRegistry specs 2014-09-19 16:24:12 -06:00