Skip to content

Commit

Permalink
Rename Instagram to BentoInstagram (ampproject#35948)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanek authored and Mahir committed Sep 9, 2021
1 parent 01c83da commit be7a457
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions extensions/amp-instagram/1.0/base-element.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {PreactBaseElement} from '#preact/base-element';

import {Instagram} from './component';
import {BentoInstagram} from './component';

export class BaseElement extends PreactBaseElement {}

/** @override */
BaseElement['Component'] = Instagram;
BaseElement['Component'] = BentoInstagram;

/** @override */
BaseElement['loadable'] = true;
Expand Down
12 changes: 6 additions & 6 deletions extensions/amp-instagram/1.0/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const MATCHES_MESSAGING_ORIGIN = (origin) =>
origin === 'https://www.instagram.com';

/**
* @param {!InstagramDef.Props} props
* @param {{current: ?InstagramDef.Api}} ref
* @param {!BentoInstagramDef.Props} props
* @param {{current: ?BentoInstagramDef.Api}} ref
* @return {PreactDef.Renderable}
*/
function InstagramWithRef(
function BentoInstagramWithRef(
{captioned, onLoad, requestResize, shortcode, title = 'Instagram', ...rest},
ref
) {
Expand Down Expand Up @@ -64,6 +64,6 @@ function InstagramWithRef(
);
}

const Instagram = forwardRef(InstagramWithRef);
Instagram.displayName = 'Instagram'; // Make findable for tests.
export {Instagram};
const BentoInstagram = forwardRef(BentoInstagramWithRef);
BentoInstagram.displayName = 'Instagram'; // Make findable for tests.
export {BentoInstagram};
8 changes: 4 additions & 4 deletions extensions/amp-instagram/1.0/component.type.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @externs */

/** @const */
var InstagramDef = {};
var BentoInstagramDef = {};

/**
* @typedef {{
Expand All @@ -14,10 +14,10 @@ var InstagramDef = {};
* onLoad: (function():undefined|undefined),
* }}
*/
InstagramDef.Props;
BentoInstagramDef.Props;

/** @constructor */
InstagramDef.Api = function () {};
BentoInstagramDef.Api = function () {};

/** @type {string} */
InstagramDef.Api.prototype.readyState;
BentoInstagramDef.Api.prototype.readyState;
16 changes: 8 additions & 8 deletions extensions/amp-instagram/1.0/storybook/Basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
BentoAccordionHeader,
BentoAccordionSection,
} from '../../../amp-accordion/1.0/component';
import {Instagram} from '../component';
import {BentoInstagram} from '../component';

export default {
title: 'Instagram',
component: Instagram,
component: BentoInstagram,
args: {
width: 500,
height: 600,
Expand All @@ -21,11 +21,11 @@ export default {

export const _default = ({height, width, ...args}) => {
return (
<Instagram
<BentoInstagram
style={{width, height}}
alt="AMP Instagram Storybook Preact Example"
alt="Bento Instagram Storybook Preact Example"
{...args}
></Instagram>
></BentoInstagram>
);
};

Expand All @@ -37,11 +37,11 @@ export const InsideAccordion = ({height, width, ...args}) => {
<h2>Post</h2>
</BentoAccordionHeader>
<BentoAccordionContent>
<Instagram
<BentoInstagram
style={{width, height}}
alt="AMP Instagram Storybook Preact Example"
alt="Bento Instagram Storybook Preact Example"
{...args}
></Instagram>
></BentoInstagram>
</BentoAccordionContent>
</BentoAccordionSection>
</BentoAccordion>
Expand Down
16 changes: 8 additions & 8 deletions extensions/amp-instagram/1.0/test/test-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {WithAmpContext} from '#preact/context';

import {waitFor} from '#testing/test-helper';

import {Instagram} from '../component';
import {BentoInstagram} from '../component';

describes.sandboxed('Instagram preact component v1.0', {}, (env) => {
describes.sandboxed('BentoInstagram preact component v1.0', {}, (env) => {
it('Normal render', () => {
const wrapper = mount(
<Instagram
<BentoInstagram
shortcode="B8QaZW4AQY_"
style={{
'width': 500,
Expand All @@ -32,7 +32,7 @@ describes.sandboxed('Instagram preact component v1.0', {}, (env) => {

it('Render with caption', () => {
const wrapper = mount(
<Instagram
<BentoInstagram
shortcode="B8QaZW4AQY_"
captioned
style={{'width': 500, 'height': 705}}
Expand All @@ -49,7 +49,7 @@ describes.sandboxed('Instagram preact component v1.0', {}, (env) => {
it('Resize prop is called', () => {
const requestResizeSpy = env.sandbox.spy();
const wrapper = mount(
<Instagram
<BentoInstagram
shortcode="B8QaZW4AQY_"
captioned
style={{'width': 500, 'height': 705}}
Expand All @@ -68,7 +68,7 @@ describes.sandboxed('Instagram preact component v1.0', {}, (env) => {

it('Height is changed', async () => {
const wrapper = mount(
<Instagram
<BentoInstagram
shortcode="B8QaZW4AQY_"
style={{'width': 500, 'height': 600}}
/>
Expand All @@ -94,7 +94,7 @@ describes.sandboxed('Instagram preact component v1.0', {}, (env) => {
const ref = createRef();
const onReadyState = env.sandbox.spy();
const wrapper = mount(
<Instagram
<BentoInstagram
ref={ref}
shortcode="B8QaZW4AQY_"
style={{'width': 500, 'height': 600}}
Expand All @@ -116,7 +116,7 @@ describes.sandboxed('Instagram preact component v1.0', {}, (env) => {
const ref = createRef();
const wrapper = mount(
<WithAmpContext playable={true}>
<Instagram
<BentoInstagram
ref={ref}
shortcode="B8QaZW4AQY_"
style={{'width': 500, 'height': 600}}
Expand Down

0 comments on commit be7a457

Please sign in to comment.