Project

General

Profile

1
import * as tslib_1 from "tslib";
2
/**
3
 * @license Angular v4.4.6
4
 * (c) 2010-2017 Google, Inc. https://angular.io/
5
 * License: MIT
6
 */
7
import { platformCoreDynamicTesting } from '@angular/compiler/testing';
8
import { Inject, Injectable, NgModule, createPlatformFactory } from '@angular/core';
9
import { TestComponentRenderer } from '@angular/core/testing';
10
import { ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS } from '@angular/platform-browser-dynamic';
11
import { BrowserTestingModule } from '@angular/platform-browser/testing';
12
import { DOCUMENT, ɵgetDOM } from '@angular/platform-browser';
13
/**
14
 * @license
15
 * Copyright Google Inc. All Rights Reserved.
16
 *
17
 * Use of this source code is governed by an MIT-style license that can be
18
 * found in the LICENSE file at https://angular.io/license
19
 */
20
/**
21
 * A DOM based implementation of the TestComponentRenderer.
22
 */
23
var DOMTestComponentRenderer = (function (_super) {
24
    tslib_1.__extends(DOMTestComponentRenderer, _super);
25
    function DOMTestComponentRenderer(_doc /** TODO #9100 */) {
26
        var _this = _super.call(this) || this;
27
        _this._doc = _doc; /** TODO #9100 */
28
        return _this;
29
    }
30
    DOMTestComponentRenderer.prototype.insertRootElement = function (rootElId) {
31
        var rootEl = ɵgetDOM().firstChild(ɵgetDOM().content(ɵgetDOM().createTemplate("<div id=\"" + rootElId + "\"></div>")));
32
        // TODO(juliemr): can/should this be optional?
33
        var oldRoots = ɵgetDOM().querySelectorAll(this._doc, '[id^=root]');
34
        for (var i = 0; i < oldRoots.length; i++) {
35
            ɵgetDOM().remove(oldRoots[i]);
36
        }
37
        ɵgetDOM().appendChild(this._doc.body, rootEl);
38
    };
39
    return DOMTestComponentRenderer;
40
}(TestComponentRenderer));
41
DOMTestComponentRenderer.decorators = [
42
    { type: Injectable },
43
];
44
/** @nocollapse */
45
DOMTestComponentRenderer.ctorParameters = function () { return [
46
    { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] },] },
47
]; };
48
/**
49
 * @license
50
 * Copyright Google Inc. All Rights Reserved.
51
 *
52
 * Use of this source code is governed by an MIT-style license that can be
53
 * found in the LICENSE file at https://angular.io/license
54
 */
55
/**
56
 * @license
57
 * Copyright Google Inc. All Rights Reserved.
58
 *
59
 * Use of this source code is governed by an MIT-style license that can be
60
 * found in the LICENSE file at https://angular.io/license
61
 */
62
/**
63
 * @stable
64
 */
65
var platformBrowserDynamicTesting = createPlatformFactory(platformCoreDynamicTesting, 'browserDynamicTesting', ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
66
/**
67
 * NgModule for testing.
68
 *
69
 * @stable
70
 */
71
var BrowserDynamicTestingModule = (function () {
72
    function BrowserDynamicTestingModule() {
73
    }
74
    return BrowserDynamicTestingModule;
75
}());
76
BrowserDynamicTestingModule.decorators = [
77
    { type: NgModule, args: [{
78
                exports: [BrowserTestingModule],
79
                providers: [
80
                    { provide: TestComponentRenderer, useClass: DOMTestComponentRenderer },
81
                ]
82
            },] },
83
];
84
/** @nocollapse */
85
BrowserDynamicTestingModule.ctorParameters = function () { return []; };
86
/**
87
 * @license
88
 * Copyright Google Inc. All Rights Reserved.
89
 *
90
 * Use of this source code is governed by an MIT-style license that can be
91
 * found in the LICENSE file at https://angular.io/license
92
 */
93
/**
94
 * @module
95
 * @description
96
 * Entry point for all public APIs of the platform-browser-dynamic/testing package.
97
 */
98
export { platformBrowserDynamicTesting, BrowserDynamicTestingModule, DOMTestComponentRenderer as ɵDOMTestComponentRenderer };
99
//# sourceMappingURL=testing.es5.js.map
(1-1/4)