Exemplo n.º 1
0
 it('should store the passed-in location', () => {
   const bindings = parseTemplateBindings('a 1,b 2', 'location');
   expect(bindings[0].expression.location).toEqual('location');
 });
Exemplo n.º 2
0
 it('calling discardPeriodicTasks should throw', () => {
   expect(() => {
     discardPeriodicTasks();
   }).toThrowError('The code should be running in the fakeAsync zone to call this function');
 });
Exemplo n.º 3
0
 it('should use the same zone as in beforeEach', fakeAsync(() => {
      zoneInTest1 = Zone.current;
      expect(zoneInTest1).toBe(zoneInBeforeEach);
    }));
Exemplo n.º 4
0
 it('should throw an error on dangling periodic timers', () => {
   expect(() => {
     fakeAsync(() => { setInterval(() => {}, 10); })();
   }).toThrowError('1 periodic timer(s) still in the queue.');
 });
Exemplo n.º 5
0
 fakeAsync((foo: any /** TODO #9100 */, bar: any /** TODO #9100 */) => {
   expect(foo).toEqual('foo');
   expect(bar).toEqual('bar');
 })('foo', 'bar');
Exemplo n.º 6
0
 it('should use the document head as default host', () => {
   ssh.addStyles(['a {};', 'b {};']);
   expect(doc.head).toHaveText('a {};b {};');
 });
Exemplo n.º 7
0
 it('should complain if a test throws an exception', () => {
   expect(() => { fakeAsync(() => { throw new Error('sync'); })(); }).toThrowError('sync');
 });
Exemplo n.º 8
0
 it('should parse prefix/suffix with multiple interpolation', () => {
   const originalExp = 'before {{ a }} middle {{ b }} after';
   const ast = parseInterpolation(originalExp).ast;
   expect(unparse(ast)).toEqual(originalExp);
   validate(ast);
 });
Exemplo n.º 9
0
 it('should parse a field access', () => {
   const p = parseSimpleBinding('name');
   expect(unparse(p)).toEqual('name');
   validate(p);
 });
Exemplo n.º 10
0
 () => { expect(parseInterpolation('nothing')).toBe(null); });