test(ivy): activate local references canonical spec (#25462)

PR Close #25462
This commit is contained in:
Pawel Kozlowski 2018-08-13 15:59:24 +02:00 committed by Ben Lesh
parent 0c4209f4b9
commit 9117fa199c
1 changed files with 10 additions and 10 deletions

View File

@ -6,19 +6,19 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; import {Component} from '../../../src/core';
import * as $r3$ from '../../../src/core_render3_private_export'; import * as $r3$ from '../../../src/core_render3_private_export';
import {renderComponent, toHtml} from '../render_util'; import {ComponentFixture} from '../render_util';
/// See: `normative.md` /// See: `normative.md`
describe('local references', () => { describe('local references', () => {
type $RenderFlags$ = $r3$.ɵRenderFlags; type $RenderFlags$ = $r3$.ɵRenderFlags;
// TODO(misko): currently disabled until local refs are working it('should translate DOM structure', () => {
xit('should translate DOM structure', () => {
type $MyComponent$ = MyComponent; type $MyComponent$ = MyComponent;
@Component({selector: 'my-component', template: `<input #user>Hello {{user.value}}!`}) @Component(
{selector: 'my-component', template: `<input #user value="World">Hello, {{user.value}}!`})
class MyComponent { class MyComponent {
// NORMATIVE // NORMATIVE
static ngComponentDef = $r3$.ɵdefineComponent({ static ngComponentDef = $r3$.ɵdefineComponent({
@ -28,19 +28,19 @@ describe('local references', () => {
template: function(rf: $RenderFlags$, ctx: $MyComponent$) { template: function(rf: $RenderFlags$, ctx: $MyComponent$) {
let l1_user: any; let l1_user: any;
if (rf & 1) { if (rf & 1) {
$r3$.ɵEe(0, 'input', null, ['user', '']); $r3$.ɵEe(0, 'input', ['value', 'World'], ['user', '']);
$r3$.ɵT(2); $r3$.ɵT(2);
} }
if (rf & 2) { if (rf & 2) {
l1_user = $r3$.ɵld<any>(1); l1_user = $r3$.ɵr<any>(1);
$r3$.ɵt(2, $r3$.ɵi1('Hello ', l1_user.value, '!')); $r3$.ɵt(2, $r3$.ɵi1('Hello, ', l1_user.value, '!'));
} }
} }
}); });
// NORMATIVE // NORMATIVE
} }
expect(toHtml(renderComponent(MyComponent))) const fixture = new ComponentFixture(MyComponent);
.toEqual('<div class="my-app" title="Hello">Hello <b>World</b>!</div>'); expect(fixture.html).toEqual(`<input value="World">Hello, World!`);
}); });
}); });