File tree Expand file tree Collapse file tree 3 files changed +34
-5
lines changed Expand file tree Collapse file tree 3 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 157
157
158
158
/**
159
159
* The name of the variable to add to the binding scope with the index
160
- * for the inst. If `sort` is provided, the index will reflect the
161
- * sorted order (rather than the original array order).
160
+ * of the instance in the sorted and filtered list of rendered items.
161
+ * Note, for the index in the `this.items` array, use the value of the
162
+ * `itemsIndexAs` property.
162
163
*/
163
164
indexAs : {
164
165
type : String ,
167
168
168
169
/**
169
170
* The name of the variable to add to the binding scope with the index
170
- * for the inst. If `sort` is provided, the index will reflect the
171
- * sorted order (rather than the original array order).
171
+ * of the instance in the `this.items` array. Note, for the index of
172
+ * this instance in the sorted and filtered list of rendered items,
173
+ * use the value of the `indexAs` property.
172
174
*/
173
175
itemsIndexAs : {
174
176
type : String ,
Original file line number Diff line number Diff line change 68
68
}
69
69
/**
70
70
* Creates a debouncer if no debouncer is passed as a parameter
71
- * or it cancels an active debouncer otherwise.
71
+ * or it cancels an active debouncer otherwise. The following
72
+ * example shows how a debouncer can be called multiple times within a
73
+ * microtask and "debounced" such that the provided callback function is
74
+ * called once. Add this method to a custom element:
75
+ *
76
+ * _debounceWork() {
77
+ * this._debounceJob = Polymer.Debouncer.debounce(this._debounceJob,
78
+ * Polymer.Async.microTask, () => {
79
+ * this._doWork();
80
+ * });
81
+ * }
82
+ *
83
+ * If the `_debounceWork` method is called multiple times within the same
84
+ * microtask, the `_doWork` function will be called only once at the next
85
+ * microtask checkpoint.
86
+ *
87
+ * Note: In testing it is often convenient to avoid asynchrony. To accomplish
88
+ * this with a debouncer, you can use `Polymer.enqueueDebouncer` and
89
+ * `Polymer.flush`. For example, extend the above example by adding
90
+ * `Polymer.enqueueDebouncer(this._debounceJob)` at the end of the
91
+ * `_debounceWork` method. Then in a test, call `Polymer.flush` to ensure
92
+ * the debouncer has completed.
72
93
*
73
94
* @param {Polymer.Debouncer? } debouncer Debouncer object.
74
95
* @param {!AsyncModule } asyncModule Object with Async interface
Original file line number Diff line number Diff line change 221
221
222
222
test ( 'scoped focus and blur events do not retarget' , function ( ) {
223
223
var el = fixture ( 'focus' ) ;
224
+ var e = new Event ( 'focus' ) ;
225
+ if ( e . isTrused !== false ) {
226
+ // skip browser if we cannot distinguish
227
+ // native focus events from user created ones
228
+ this . skip ( ) ;
229
+ }
224
230
el . fireScoped ( ) ;
225
231
assert . equal ( el . events . length , 1 ) ;
226
232
assert . equal ( el . events [ 0 ] , el . $ . child ) ;
You can’t perform that action at this time.
0 commit comments