Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename CustomElement.build to buildInternal #32342

Merged
merged 2 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ads/google/a4a/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function noopMethods(
}
) {
const noop = () => {};
impl.element.build = noop;
impl.element.buildInternal = noop;
impl.element.getPlaceholder = noop;
impl.element.createPlaceholder = noop;
sandbox.stub(impl, 'getAmpDoc').returns(ampdoc);
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-3d-gltf/0.1/test/test-amp-3d-gltf.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describes.realWin(
amp3dGltfEl.setAttribute('height', '240');

doc.body.appendChild(amp3dGltfEl);
await amp3dGltfEl.build();
await amp3dGltfEl.buildInternal();

const amp3dGltf = await amp3dGltfEl.getImpl();
env.sandbox
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-3q-player/0.1/test/test-amp-3q-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describes.realWin(
player.setAttribute('data-id', playoutId);
}
doc.body.appendChild(player);
await player.build();
await player.buildInternal();
player.layoutCallback();
const iframe = player.querySelector('iframe');
const impl = await player.getImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describes.realWin(
<amp-a4a layout="fixed" width="100" height="100"></amp-a4a>
`;
doc.body.appendChild(element);
await element.build();
await element.buildInternal();
impl = await element.getImpl();
});

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-accordion/0.1/test/test-amp-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describes.realWin(
}
doc.body.appendChild(ampAccordion);
return ampAccordion
.build()
.buildInternal()
.then(() => ampAccordion.getImpl())
.then((impl) => {
impl.mutateElement = (fn) =>
Expand Down Expand Up @@ -697,7 +697,7 @@ describes.realWin(
ampAccordion2.appendChild(section);
}
doc.body.appendChild(ampAccordion2);
await ampAccordion2.build();
await ampAccordion2.buildInternal();

impl.mutateElement = (fn) => fn();
await ampAccordion.layoutCallback();
Expand Down
16 changes: 8 additions & 8 deletions extensions/amp-accordion/1.0/test/test-amp-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describes.realWin(
</amp-accordion>
`;
win.document.body.appendChild(element);
await element.build();
await element.buildInternal();
});

it('should render expanded and collapsed sections', () => {
Expand Down Expand Up @@ -323,7 +323,7 @@ describes.realWin(
</amp-accordion>
`;
win.document.body.appendChild(element);
await element.build();
await element.buildInternal();

const sections = element.children;
const {
Expand Down Expand Up @@ -407,7 +407,7 @@ describes.realWin(
</amp-accordion>
`;
win.document.body.appendChild(element);
await element.build();
await element.buildInternal();
});

function invocation(method, args = {}) {
Expand Down Expand Up @@ -573,7 +573,7 @@ describes.realWin(
</amp-accordion>
`;
win.document.body.appendChild(element);
await element.build();
await element.buildInternal();
});

it('should not animate on build', () => {
Expand Down Expand Up @@ -652,7 +652,7 @@ describes.realWin(
win.document.body.appendChild(element);
win.CSS.supports = () => true;
win.document.body.onbeforematch = null;
await element.build();
await element.buildInternal();

const section1 = element.children[0];
const content1 = section1.lastElementChild;
Expand All @@ -667,7 +667,7 @@ describes.realWin(
win.document.body.appendChild(element);
win.CSS.supports = () => true;
win.document.body.onbeforematch = null;
await element.build();
await element.buildInternal();

const section2 = element.children[1];
const content2 = section2.lastElementChild;
Expand All @@ -684,7 +684,7 @@ describes.realWin(
win.document.body.appendChild(element);
win.CSS.supports = () => true;
win.document.body.onbeforematch = null;
await element.build();
await element.buildInternal();

const section1 = element.children[0];
const content1 = section1.lastElementChild;
Expand Down Expand Up @@ -817,7 +817,7 @@ describes.realWin(
</amp-accordion>
`;
win.document.body.appendChild(element);
await element.build();
await element.buildInternal();

section1 = element.children[0];
section2 = element.children[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describes.realWin(
function newActionMacro() {
const actionMacro = doc.createElement('amp-action-macro');
doc.body.appendChild(actionMacro);
return actionMacro.build().then(() => {
return actionMacro.buildInternal().then(() => {
return actionMacro.layoutCallback();
});
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-ad-exit/0.1/test/test-amp-ad-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describes.realWin(
json.setAttribute('type', 'application/json');
el.appendChild(json);
win.document.body.appendChild(el);
return el.build().then(() => el);
return el.buildInternal().then(() => el);
}

// Ad ad div or the relativeTo element cannot be found.
Expand Down Expand Up @@ -220,7 +220,7 @@ describes.realWin(
el.appendChild(win.document.createElement('p'));
win.document.body.appendChild(el);
let promise;
allowConsoleError(() => (promise = el.build()));
allowConsoleError(() => (promise = el.buildInternal()));
return promise.should.be.rejectedWith(/application\/json/);
});

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-addthis/0.1/test/test-amp-addthis.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describes.realWin(
}
doc.body.appendChild(at);
return at
.build()
.buildInternal()
.then(() => {
if (opt_beforeLayoutCallback) {
opt_beforeLayoutCallback(at);
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-animation/0.1/test/test-amp-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describes.sandboxed('AmpAnimation', {}, (env) => {
}

win.document.body.appendChild(element);
return element.build().then(() => element.getImpl());
return element.buildInternal().then(() => element.getImpl());
}

function updateIntersection(target, intersectionRatio) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describes.realWin(
media.setAttribute('layout', 'responsive');
}
doc.body.appendChild(media);
await media.build();
await media.buildInternal();

const impl = await media.getImpl();
changeSizeSpy = env.sandbox.spy(impl, 'forceChangeHeight');
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-app-banner/0.1/test/test-amp-app-banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describes.realWin(

banner.id = 'banner0';
doc.body.appendChild(banner);
await banner.build();
await banner.buildInternal();
await banner.layoutCallback();
return banner;
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-audio/0.1/test/test-amp-audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describes.realWin(
naturalDimensions_['AMP-AUDIO'] = {width: '300px', height: '30px'};
const ampAudio = getAmpAudio(attributes, opt_childNodesAttrs);
return ampAudio
.build()
.buildInternal()
.then(() => ampAudio.layoutCallback())
.then(() => ampAudio)
.catch((error) => {
Expand All @@ -86,7 +86,7 @@ describes.realWin(
doc.body.appendChild(ampStory);

return ampAudio
.build()
.buildInternal()
.then(() => ampAudio.layoutCallback())
.then(() => ampAudio)
.catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-auto-ads/0.1/test/test-amp-auto-ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describes.realWin(
ampAutoAds.setAttribute('type', type || '_ping_');
}
doc.body.appendChild(ampAutoAds);
return ampAutoAds.build().then(() => {
return ampAutoAds.buildInternal().then(() => {
return ampAutoAds.layoutCallback();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describes.realWin(
);
form.appendChild(ampAutocomplete);
doc.body.appendChild(form);
return ampAutocomplete.build().then(() => ampAutocomplete);
return ampAutocomplete.buildInternal().then(() => ampAutocomplete);
}

it('should build with "inline" and "query" when specified', async () => {
Expand Down Expand Up @@ -347,7 +347,7 @@ describes.realWin(
it('should not require a form ancestor', () => {
const autocomplete = setupAutocomplete({'filter': 'substring'});
doc.body.appendChild(autocomplete);
return expect(autocomplete.build()).to.be.fulfilled;
return expect(autocomplete.buildInternal()).to.be.fulfilled;
});

it('should read the autocomplete attribute on the form as null', async () => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-beopinion/0.1/test/test-amp-beopinion.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describes.realWin(
ampBeOpinion.setAttribute('height', '222');
doc.body.appendChild(ampBeOpinion);
return ampBeOpinion
.build()
.buildInternal()
.then(() => ampBeOpinion.layoutCallback())
.then(() => ampBeOpinion);
}
Expand Down
18 changes: 9 additions & 9 deletions extensions/amp-bind/0.1/test/test-amp-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describes.realWin(

it('should not fetch until doc is visible', async () => {
element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

whenFirstVisiblePromiseReject();
await whenFirstVisiblePromise.catch(() => {});
Expand All @@ -85,7 +85,7 @@ describes.realWin(

it('should fetch if `src` attribute exists', async () => {
element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

whenFirstVisiblePromiseResolve();
await whenFirstVisiblePromise;
Expand Down Expand Up @@ -113,7 +113,7 @@ describes.realWin(
env.sandbox.stub(Services, 'actionServiceForDoc').returns(actions);

element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

expect(actions.trigger).to.not.have.been.called;

Expand All @@ -135,7 +135,7 @@ describes.realWin(
env.sandbox.spy(ampState, 'registerAction');

element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

expect(ampState.registerAction).calledWithExactly(
'refresh',
Expand All @@ -147,7 +147,7 @@ describes.realWin(
env.sandbox.spy(ampState, 'registerAction');

element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

const action = {method: 'refresh', satisfiesTrust: () => true};
await ampState.executeAction(action);
Expand All @@ -169,7 +169,7 @@ describes.realWin(
it('should parse its child script', async () => {
element.innerHTML =
'<script type="application/json">{"local": "data"}</script>';
await element.build();
await element.buildInternal();

expect(bind.setState).calledWithMatch(
{myAmpState: {local: 'data'}},
Expand All @@ -186,7 +186,7 @@ describes.realWin(
element.innerHTML =
'<script type="application/json">{"local": "data"}</script>';
element.setAttribute('src', 'https://foo.com/bar?baz=1');
await element.build();
await element.buildInternal();

// No fetch should happen until doc is visible.
expect(ampState.fetch_).to.not.have.been.called;
Expand All @@ -209,7 +209,7 @@ describes.realWin(

it('should not fetch if `src` is mutated and doc is not visible', () => {
element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

// No fetch should happen until doc is visible.
expect(ampState.fetch_).to.not.have.been.called;
Expand All @@ -224,7 +224,7 @@ describes.realWin(

it('should fetch json if `src` is mutated', async () => {
element.setAttribute('src', 'https://foo.com/bar?baz=1');
element.build();
element.buildInternal();

// No fetch should happen until doc is visible.
expect(ampState.fetch_).to.not.have.been.called;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describes.realWin(
});
doc.body.appendChild(bc);
return bc
.build()
.buildInternal()
.then(() => {
bc.layoutCallback();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describes.realWin(

doc.body.appendChild(elem);
return elem
.build()
.buildInternal()
.then(() => elem.getImpl())
.then((impl) => {
urlMock.expandUrlAsync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describes.realWin(

doc.body.appendChild(callTrackingEl);
return callTrackingEl
.build()
.buildInternal()
.then(() => {
return callTrackingEl.layoutCallback();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describes.realWin(

doc.body.appendChild(carouselElement);
return carouselElement
.build()
.buildInternal()
.then(() => {
carouselElement.updateLayoutBox({
top: 0,
Expand Down
6 changes: 3 additions & 3 deletions extensions/amp-carousel/0.1/test/test-slidescroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describes.realWin(
if (opt_attachToDom) {
doc.body.appendChild(ampSlideScroll);
return ampSlideScroll
.build()
.buildInternal()
.then(() => {
ampSlideScroll.updateLayoutBox({
top: 0,
Expand Down Expand Up @@ -1267,7 +1267,7 @@ describes.realWin(
// Layout happens asynchronously after attaching to DOM, so we can
// test pre-layoutCallback logic now.
doc.body.appendChild(ampSlideScroll);
await ampSlideScroll.build();
await ampSlideScroll.buildInternal();

const impl = await ampSlideScroll.getImpl();
const showSlideSpy = env.sandbox.spy(impl, 'showSlide_');
Expand All @@ -1291,7 +1291,7 @@ describes.realWin(
it('should NOT call showSlide_ before re-layout', async () => {
const ampSlideScroll = await getAmpSlideScroll(false, 5, false);
doc.body.appendChild(ampSlideScroll);
await ampSlideScroll.build();
await ampSlideScroll.buildInternal();

const impl = await ampSlideScroll.getImpl();
const showSlideSpy = env.sandbox.spy(impl, 'showSlide_');
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-carousel/0.2/test/test-type-slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describes.realWin(
}

container.appendChild(carousel);
await carousel.build();
await carousel.buildInternal();
carousel.updateLayoutBox({
top: 0,
left: 0,
Expand Down
Loading