本文整理汇总了TypeScript中rxjs/operators.skip函数的典型用法代码示例。如果您正苦于以下问题:TypeScript skip函数的具体用法?TypeScript skip怎么用?TypeScript skip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skip函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should emit rangeChange when selected start and end dates', (done) => {
rangepicker.visibleDate = new Date(2018, 8, 17);
showRangepicker();
rangepicker.rangeChange
.pipe(skip(1))
.subscribe((range: NbCalendarRange<Date>) => {
expect(range.start.getFullYear()).toEqual(2018);
expect(range.end.getFullYear()).toEqual(2018);
expect(range.start.getMonth()).toEqual(8);
expect(range.end.getMonth()).toEqual(8);
expect(range.start.getDate()).toEqual(1);
expect(range.end.getDate()).toEqual(3);
done();
});
// click on Sep 1
const startCell = overlay.querySelectorAll('.day-cell')[6];
(startCell as HTMLElement).click();
// click on Sep 3
const endCell = overlay.querySelectorAll('.day-cell')[8];
(endCell as HTMLElement).click();
fixture.detectChanges();
}, 5000);
开发者ID:kevinheader,项目名称:nebular,代码行数:25,代码来源:datepicker.spec.ts
示例2: it
it('should be able to filter snapshotChanges() types - added/modified', async (done) => {
const ITEMS = 10;
let { randomCollectionName, ref, stocks, names } = await collectionHarness(afs, ITEMS);
const nextId = ref.doc('a').id;
let count = 0;
const sub = stocks.snapshotChanges(['added', 'modified']).pipe(skip(1),take(2)).subscribe(data => {
count += 1;
if (count == 1) {
const change = data.filter(x => x.payload.doc.id === nextId)[0];
expect(data.length).toEqual(ITEMS + 1);
expect(change.payload.doc.data().price).toEqual(2);
expect(change.type).toEqual('added');
delayUpdate(stocks, names[0], { price: 2 });
}
if (count == 2) {
const change = data.filter(x => x.payload.doc.id === names[0])[0];
expect(data.length).toEqual(ITEMS + 1);
expect(change.payload.doc.data().price).toEqual(2);
expect(change.type).toEqual('modified');
}
}).add(() => {
deleteThemAll(names, ref).then(done).catch(done.fail);
});
names = names.concat([nextId]);
delayAdd(stocks, nextId, { price: 2 });
});
开发者ID:Tetsumote,项目名称:angularfire2,代码行数:28,代码来源:collection.spec.ts
示例3: it
it('should allow going forward a route with type `goForward`', done => {
function main(_sources: {history: Observable<Location>}) {
return {
history: of<HistoryInput | string>(
'/test',
'/other',
{type: 'go', amount: -1},
{type: 'goForward'}
),
};
}
const {sources, run} = setup(main, {
history: makeServerHistoryDriver(),
});
const expected = ['/test', '/other', '/test', '/other'];
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {
assert.strictEqual(location.pathname, expected.shift());
if (expected.length === 0) {
done();
}
},
error: done,
complete: () => {
done('complete should not be called');
},
});
run();
});
开发者ID:,项目名称:,代码行数:32,代码来源:
示例4: it
it('should get Gamma sidekick after creating and assigning one', (done: DoneFn) => {
// Skip(1), the initial state in which Gamma has no sidekick
// Note that BOTH dispatches complete synchronously, before the selector updates
// so we only have to skip one.
createHeroSidekickSelector$(3)
.pipe(skip(1))
.subscribe(sk => {
expect(sk.name).toBe('Robin');
done();
});
// create a new sidekick
let action: EntityAction = eaFactory.create<Sidekick>('Sidekick', EntityOp.ADD_ONE, {
id: 42,
name: 'Robin'
});
store.dispatch(action);
// assign new sidekick to Gamma
action = eaFactory.create<Update<Hero>>('Hero', EntityOp.UPDATE_ONE, {
id: 3,
changes: { id: 3, sidekickFk: 42 }
});
store.dispatch(action);
});
开发者ID:RajeevSingh273,项目名称:angular-ngrx-data,代码行数:25,代码来源:related-entity-selectors.spec.ts
示例5: resolve
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Page<Item>> {
this.store.dispatch(
new FindItemsByPodcastsAndPageAction(route.params.id)
);
return this.store.pipe(select(selectPodcastItems), skip(1), take(1));
}
开发者ID:davinkevin,项目名称:Podcast-Server,代码行数:7,代码来源:podcast-items.resolver.ts
示例6: it
it('should unsubscribe scheduled actions after execution', () => {
let subscribeSpy: any = null;
const counts: number[] = [];
const e1 = cold('a|');
const expected = '--a-(a|)';
const duration = time('-|');
const result = e1.pipe(
repeatWhen(notifications => {
const delayed = notifications.pipe(delay(duration, rxTestScheduler));
subscribeSpy = sinon.spy(delayed['source'], 'subscribe');
return delayed;
}),
skip(1),
take(2),
tap({
next() {
const [[subscriber]] = subscribeSpy.args;
counts.push(subscriber._subscriptions.length);
},
complete() {
expect(counts).to.deep.equal([1, 1]);
}
})
);
expectObservable(result).toBe(expected);
});
开发者ID:tomastrajan,项目名称:rxjs,代码行数:28,代码来源:delay-spec.ts
示例7: it
it('should emit true when the socket establishes a connection with the ws server', done => {
const brayns = new Client(host);
brayns.ready.pipe(skip(1), take(1))
.subscribe(ready => {
expect(ready).toBe(true);
done();
});
});
开发者ID:chevtche,项目名称:Brayns,代码行数:8,代码来源:client.spec.ts
示例8: it
it('should complete regardless of skip count if source is empty', () => {
const e1 = cold('|');
const e1subs = '(^!)';
const expected = '|';
expectObservable(e1.pipe(skip(3))).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});
开发者ID:DallanQ,项目名称:rxjs,代码行数:8,代码来源:skip-spec.ts
示例9: asDiagram
asDiagram('skip(3)')('should skip values before a total', () => {
const source = hot('--a--b--c--d--e--|');
const subs = '^ !';
const expected = '-----------d--e--|';
expectObservable(source.pipe(skip(3))).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});
开发者ID:DallanQ,项目名称:rxjs,代码行数:8,代码来源:skip-spec.ts
注:本文中的rxjs/operators.skip函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论