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": { "master": {
"uncompressed": { "uncompressed": {
"runtime": 2768, "runtime": 2768,
"main": 475857, "main": 475855,
"polyfills": 38453, "polyfills": 38453,
"prettify": 14913 "prettify": 14913
} }

View File

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

View File

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

View File

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

View File

@ -300,7 +300,7 @@ describe('DocViewerComponent', () => {
beforeEach(() => { beforeEach(() => {
const elementsLoader = TestBed.get(ElementsLoader) as MockElementsLoader; 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'); prepareTitleAndTocSpy = spyOn(docViewer, 'prepareTitleAndToc');
swapViewsSpy = spyOn(docViewer, 'swapViews').and.returnValue(of(undefined)); 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. // and is considered to be safe.
tap(() => this.nextViewContainer.innerHTML = doc.contents || ''), tap(() => this.nextViewContainer.innerHTML = doc.contents || ''),
tap(() => addTitleAndToc = this.prepareTitleAndToc(this.nextViewContainer, doc.id)), tap(() => addTitleAndToc = this.prepareTitleAndToc(this.nextViewContainer, doc.id)),
switchMap(() => this.elementsLoader.loadContainingCustomElements(this.nextViewContainer)), switchMap(() => this.elementsLoader.loadContainedCustomElements(this.nextViewContainer)),
tap(() => this.docReady.emit()), tap(() => this.docReady.emit()),
switchMap(() => this.swapViews(addTitleAndToc)), switchMap(() => this.swapViews(addTitleAndToc)),
tap(() => this.docRendered.emit()), tap(() => this.docRendered.emit()),

View File

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