BVB Source Codes

in-view Show registry.emit.spec.js Source code

Return Download in-view: download registry.emit.spec.js Source code - Download in-view Source code - Type:.js
  1. import test from 'ava';
  2. import Registry from '../src/registry';
  3.  
  4. test('Registry.emit calls each handler', t => {
  5.  
  6.     let registry = Registry([]);
  7.  
  8.     registry.on('enter', x => t.true(x === 'a'));
  9.     registry.on('enter', y => t.true(y === 'a'));
  10.  
  11.     registry.on('exit', x => t.true(x === 'b'));
  12.     registry.on('exit', y => t.true(y === 'b'));
  13.  
  14.     registry.once('enter', x => t.true(x === 'a'));
  15.     registry.once('enter', y => t.true(y === 'a'));
  16.  
  17.     registry.once('exit', x => t.true(x === 'b'));
  18.     registry.once('exit', y => t.true(y === 'b'));
  19.  
  20.     registry.emit('enter', 'a');
  21.     registry.emit('exit', 'b');
  22.  
  23. });
  24.  
  25. test('Registry.emit removes once handlers', t => {
  26.  
  27.     let registry = Registry([]);
  28.  
  29.     registry.once('enter', () => {});
  30.     t.true(registry.singles.enter.length === 1);
  31.  
  32.     registry.emit('enter', {});
  33.     t.true(!registry.singles.enter.length);
  34.  
  35. });
  36.  
  37. test('Registry.emit returns the registry', t => {
  38.     let registry = Registry([]);
  39.     t.deepEqual(registry.emit('enter', {}), registry);
  40. });
  41.  
downloadregistry.emit.spec.js Source code - Download in-view Source code
Related Source Codes/Software:
magictools - 2017-01-09
elm-compiler - Compiler for Elm, a functional language for reliab... 2017-01-09
Twig - Twig, the flexible, fast, and secure template lang... 2017-01-09
android-testing - A collection of samples demonstrating different fr... 2017-01-09
lib-flexible - Scalable layout scheme 2017-01-09
sinon - Test spies, stubs and mocks for JavaScript. ... 2017-01-09
docker-gitlab - Dockerized GitLab http://www.da... 2017-01-09
Side-Menu.Android - Side menu with some categories to choose. ... 2017-01-09
libsodium - A modern and easy-to-use crypto library. 2017-01-09
prerender - Node server that uses phantomjs to render a javasc... 2017-01-09
zen - IOS, Swift, Objective - C 2017-04-25
neural-storyteller - A recurrent neural network for generating little s... 2017-04-25
CTAssetsPickerController - iOS control that allows picking multiple photos an... 2017-04-25
retire - A rich Ruby API and DSL for the Elasticsearch sear... 2017-04-25
jxcore - Evented IO for ChakraCore, SpiderMonkey & V8 J... 2017-04-25
node.io - 2017-04-25
PHPVerbalExpressions - PHP Regular expressions made easy 2017-04-25
Laravel-Administrator - An administrative interface package for Laravel ... 2017-04-25
elasticsearch-dump - Import and export tools for elasticsearch 2017-04-25
flyway - Flyway by Boxfuse Database Migrations Made Easy. ... 2017-04-25

 Back to top