refactor(aio): rename method (loadContainingCustomElements --> loadContainedCustomElements) (#23944)
PR Close #23944
This commit is contained in:
parent
7866684f2b
commit
c2e131119b
|
@ -3,7 +3,7 @@
|
|||
"master": {
|
||||
"uncompressed": {
|
||||
"runtime": 2768,
|
||||
"main": 475857,
|
||||
"main": 475855,
|
||||
"polyfills": 38453,
|
||||
"prettify": 14913
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('LazyCustomElementComponent', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
mockElementsLoader = jasmine.createSpyObj<ElementsLoader>('ElementsLoader', [
|
||||
'loadContainingCustomElements',
|
||||
'loadContainedCustomElements',
|
||||
'loadCustomElement',
|
||||
]);
|
||||
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
|
|
|
@ -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()),
|
||||
|
|
|
@ -56,8 +56,8 @@ export class MockTocService {
|
|||
}
|
||||
|
||||
export class MockElementsLoader {
|
||||
loadContainingCustomElements =
|
||||
jasmine.createSpy('MockElementsLoader#loadContainingCustomElements');
|
||||
loadContainedCustomElements =
|
||||
jasmine.createSpy('MockElementsLoader#loadContainedCustomElements');
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
|
Loading…
Reference in New Issue