Skip to content

Commit b0ceb04

Browse files
DOM: Fix Observable predicate function
See WICG/observable#140, for the issue about Predicate having an index parameter. [email protected] Bug: 40282760 Change-Id: I94fdfcf9317ec3e364f5636c3808c7a39d88c54e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5478849 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1291655}
1 parent 2c67022 commit b0ceb04

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dom/observable/tentative/observable-filter.any.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,15 @@ test(() => {
103103
['source teardown', 'source abort event', 'filter observable complete']);
104104
}, "filter(): Upon source completion, source Observable teardown sequence " +
105105
"happens after downstream filter complete() is called");
106+
107+
test(() => {
108+
const source = new Observable(subscriber => {
109+
subscriber.next('value1');
110+
subscriber.next('value2');
111+
subscriber.next('value3');
112+
});
113+
114+
const indices = [];
115+
source.filter((value, index) => indices.push(index)).subscribe();
116+
assert_array_equals(indices, [0, 1, 2]);
117+
}, "filter(): Index is passed correctly to predicate");

0 commit comments

Comments
 (0)