refactor(aio): rename method (loadContainingCustomElements --> loadContainedCustomElements) (#23944)

PR Close #23944
This commit is contained in:
George Kalpakas 2018-05-22 17:31:05 +03:00 committed by Matias Niemelä
parent 7866684f2b
commit c2e131119b
8 changed files with 13 additions and 13 deletions

View File

@ -3,7 +3,7 @@
"master": {
"uncompressed": {
"runtime": 2768,
"main": 475857,
"main": 475855,
"polyfills": 38453,
"prettify": 14913
}

View File

@ -1306,7 +1306,7 @@ function createTestingModule(initialUrl: string, mode: string = 'stable') {
}
class TestElementsLoader {
loadContainingCustomElements = jasmine.createSpy('loadContainingCustomElements')
loadContainedCustomElements = jasmine.createSpy('loadContainedCustomElements')
.and.returnValue(of(undefined));
loadCustomElement = jasmine.createSpy('loadCustomElement')

View File

@ -33,7 +33,7 @@ describe('ElementsLoader', () => {
elementsLoader = injector.get(ElementsLoader);
});
describe('loadContainingCustomElements()', () => {
describe('loadContainedCustomElements()', () => {
let loadCustomElementSpy: jasmine.Spy;
beforeEach(() => loadCustomElementSpy = spyOn(elementsLoader, 'loadCustomElement'));
@ -47,7 +47,7 @@ describe('ElementsLoader', () => {
<element-b-selector></element-b-selector>
`;
elementsLoader.loadContainingCustomElements(hostEl);
elementsLoader.loadContainedCustomElements(hostEl);
flushMicrotasks();
expect(loadCustomElementSpy).toHaveBeenCalledTimes(2);
@ -63,7 +63,7 @@ describe('ElementsLoader', () => {
<element-b-selector></element-b-selector>
`;
elementsLoader.loadContainingCustomElements(hostEl);
elementsLoader.loadContainedCustomElements(hostEl);
flushMicrotasks();
expect(loadCustomElementSpy).toHaveBeenCalledTimes(1);
@ -80,7 +80,7 @@ describe('ElementsLoader', () => {
`;
const log: any[] = [];
elementsLoader.loadContainingCustomElements(hostEl).subscribe(
elementsLoader.loadContainedCustomElements(hostEl).subscribe(
v => log.push(`emitted: ${v}`),
e => log.push(`errored: ${e}`),
() => log.push('completed'),
@ -108,7 +108,7 @@ describe('ElementsLoader', () => {
`;
const log: any[] = [];
elementsLoader.loadContainingCustomElements(hostEl).subscribe(
elementsLoader.loadContainedCustomElements(hostEl).subscribe(
v => log.push(`emitted: ${v}`),
e => log.push(`errored: ${e}`),
() => log.push('completed'),

View File

@ -26,7 +26,7 @@ export class ElementsLoader {
* the browser. Custom elements that are registered will be removed from the list of unregistered
* elements so that they will not be queried in subsequent calls.
*/
loadContainingCustomElements(element: HTMLElement): Observable<void> {
loadContainedCustomElements(element: HTMLElement): Observable<void> {
const unregisteredSelectors = Array.from(this.elementsToLoad.keys())
.filter(s => element.querySelector(s));

View File

@ -11,7 +11,7 @@ describe('LazyCustomElementComponent', () => {
beforeEach(() => {
mockElementsLoader = jasmine.createSpyObj<ElementsLoader>('ElementsLoader', [
'loadContainingCustomElements',
'loadContainedCustomElements',
'loadCustomElement',
]);

View File

@ -300,7 +300,7 @@ describe('DocViewerComponent', () => {
beforeEach(() => {
const elementsLoader = TestBed.get(ElementsLoader) as MockElementsLoader;
loadElementsSpy = elementsLoader.loadContainingCustomElements.and.returnValue(of(undefined));
loadElementsSpy = elementsLoader.loadContainedCustomElements.and.returnValue(of(undefined));
prepareTitleAndTocSpy = spyOn(docViewer, 'prepareTitleAndToc');
swapViewsSpy = spyOn(docViewer, 'swapViews').and.returnValue(of(undefined));
});

View File

@ -136,7 +136,7 @@ export class DocViewerComponent implements OnDestroy {
// and is considered to be safe.
tap(() => this.nextViewContainer.innerHTML = doc.contents || ''),
tap(() => addTitleAndToc = this.prepareTitleAndToc(this.nextViewContainer, doc.id)),
switchMap(() => this.elementsLoader.loadContainingCustomElements(this.nextViewContainer)),
switchMap(() => this.elementsLoader.loadContainedCustomElements(this.nextViewContainer)),
tap(() => this.docReady.emit()),
switchMap(() => this.swapViews(addTitleAndToc)),
tap(() => this.docRendered.emit()),

View File

@ -56,8 +56,8 @@ export class MockTocService {
}
export class MockElementsLoader {
loadContainingCustomElements =
jasmine.createSpy('MockElementsLoader#loadContainingCustomElements');
loadContainedCustomElements =
jasmine.createSpy('MockElementsLoader#loadContainedCustomElements');
}
@NgModule({