text
stringlengths 0
14.1k
|
---|
})); |
tb.createView(MyComp).then((function(view) { |
var location = view.rawView.locals.get(""loc""); |
loader.loadNextToExistingLocation(DynamicallyLoaded, location.elementRef).then((function(ref) { |
loader.loadNextToExistingLocation(DynamicallyLoaded2, location.elementRef).then((function(ref2) { |
expect(view.rootNodes).toHaveText(""Location;DynamicallyLoaded;DynamicallyLoaded2;""); |
ref2.dispose(); |
expect(view.rootNodes).toHaveText(""Location;DynamicallyLoaded;""); |
async.done(); |
})); |
})); |
})); |
}))); |
it('should update host properties', inject([DynamicComponentLoader, TestBed, AsyncTestCompleter], (function(loader, tb, async) { |
tb.overrideView(MyComp, new View({ |
template: '<div><location #loc></location></div>', |
directives: [Location] |
})); |
tb.createView(MyComp).then((function(view) { |
var location = view.rawView.locals.get(""loc""); |
loader.loadNextToExistingLocation(DynamicallyLoadedWithHostProps, location.elementRef).then((function(ref) { |
ref.instance.id = ""new value""; |
view.detectChanges(); |
var newlyInsertedElement = DOM.childNodesAsList(view.rootNodes[0])[1]; |
expect(newlyInsertedElement.id).toEqual(""new value""); |
async.done(); |
})); |
})); |
}))); |
})); |
describe('loading into a new location', (function() { |
it('should allow to create, update and destroy components', inject([TestBed, AsyncTestCompleter], (function(tb, async) { |
tb.overrideView(MyComp, new View({ |
template: '<imp-ng-cmp #impview></imp-ng-cmp>', |
directives: [ImperativeViewComponentUsingNgComponent] |
})); |
tb.createView(MyComp).then((function(view) { |
var userViewComponent = view.rawView.locals.get(""impview""); |
userViewComponent.done.then((function(childComponentRef) { |
view.detectChanges(); |
expect(view.rootNodes).toHaveText('hello'); |
childComponentRef.instance.ctxProp = 'new'; |
view.detectChanges(); |
expect(view.rootNodes).toHaveText('new'); |
childComponentRef.dispose(); |
expect(view.rootNodes).toHaveText(''); |
async.done(); |
})); |
})); |
}))); |
})); |
}); |
} |
$__export(""main"", main); |
return { |
setters: [function($__m) { |
AsyncTestCompleter = $__m.AsyncTestCompleter; |
beforeEach = $__m.beforeEach; |
ddescribe = $__m.ddescribe; |
xdescribe = $__m.xdescribe; |
describe = $__m.describe; |
el = $__m.el; |
dispatchEvent = $__m.dispatchEvent; |
expect = $__m.expect; |
iit = $__m.iit; |
inject = $__m.inject; |
beforeEachBindings = $__m.beforeEachBindings; |
it = $__m.it; |
xit = $__m.xit; |
}, function($__m) { |
TestBed = $__m.TestBed; |
}, function($__m) { |
Component = $__m.Component; |
}, function($__m) { |
View = $__m.View; |
}, function($__m) { |
DynamicComponentLoader = $__m.DynamicComponentLoader; |
}, function($__m) { |
ElementRef = $__m.ElementRef; |
}, function($__m) { |
If = $__m.If; |
}, function($__m) { |
DirectDomRenderer = $__m.DirectDomRenderer; |
}, function($__m) { |
DOM = $__m.DOM; |
}], |
execute: function() { |
ImperativeViewComponentUsingNgComponent = (function() { |
var ImperativeViewComponentUsingNgComponent = function ImperativeViewComponentUsingNgComponent(self, dynamicComponentLoader, renderer) { |
var div = el('<div></div>'); |
renderer.setImperativeComponentRootNodes(self.parentView.render, self.boundElementIndex, [div]); |
this.done = dynamicComponentLoader.loadIntoNewLocation(ChildComp, self, div, null); |
}; |
return ($traceurRuntime.createClass)(ImperativeViewComponentUsingNgComponent, {}, {}); |
}()); |
Object.defineProperty(ImperativeViewComponentUsingNgComponent, ""annotations"", {get: function() { |
return [new Component({selector: 'imp-ng-cmp'}), new View({renderer: 'imp-ng-cmp-renderer'})]; |
}}); |
Object.defineProperty(ImperativeViewComponentUsingNgComponent, ""parameters"", {get: function() { |
return [[ElementRef], [DynamicComponentLoader], [DirectDomRenderer]]; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.