Skip to content

Commit

Permalink
Rename Twitter to BentoTwitter (#35933)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanek committed Sep 3, 2021
1 parent 196a923 commit 1297f95
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions extensions/amp-twitter/1.0/base-element.js
@@ -1,10 +1,10 @@
import {PreactBaseElement} from '#preact/base-element';
import {Twitter} from './component';
import {BentoTwitter} from './component';

export class BaseElement extends PreactBaseElement {}

/** @override */
BaseElement['Component'] = Twitter;
BaseElement['Component'] = BentoTwitter;

/** @override */
BaseElement['props'] = {
Expand Down
12 changes: 6 additions & 6 deletions extensions/amp-twitter/1.0/component.js
Expand Up @@ -11,11 +11,11 @@ const FULL_HEIGHT = '100%';
const MATCHES_MESSAGING_ORIGIN = () => true;

/**
* @param {!TwitterDef.Props} props
* @param {{current: (!TwitterDef.Api|null)}} ref
* @param {!BentoTwitterDef.Props} props
* @param {{current: (!BentoTwitterDef.Api|null)}} ref
* @return {PreactDef.Renderable}
*/
function TwitterWithRef(
function BentoTwitterWithRef(
{
cards,
conversation,
Expand Down Expand Up @@ -102,6 +102,6 @@ function TwitterWithRef(
);
}

const Twitter = forwardRef(TwitterWithRef);
Twitter.displayName = 'Twitter'; // Make findable for tests.
export {Twitter};
const BentoTwitter = forwardRef(BentoTwitterWithRef);
BentoTwitter.displayName = 'BentoTwitter'; // Make findable for tests.
export {BentoTwitter};
8 changes: 4 additions & 4 deletions extensions/amp-twitter/1.0/component.type.js
@@ -1,7 +1,7 @@
/** @externs */

/** @const */
var TwitterDef = {};
var BentoTwitterDef = {};

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

/** @constructor */
TwitterDef.Api = function () {};
BentoTwitterDef.Api = function () {};

/** @type {string} */
TwitterDef.Api.prototype.readyState;
BentoTwitterDef.Api.prototype.readyState;
10 changes: 5 additions & 5 deletions extensions/amp-twitter/1.0/storybook/Basic.js
@@ -1,10 +1,10 @@
import * as Preact from '#preact';
import {Twitter} from '../component';
import {BentoTwitter} from '../component';
import {boolean, number, select, withKnobs} from '@storybook/addon-knobs';

export default {
title: 'Twitter',
component: Twitter,
component: BentoTwitter,
decorators: [withKnobs],
};

Expand All @@ -17,7 +17,7 @@ export const _default = () => {
const cards = boolean('show cards', true) ? undefined : 'hidden';
const conversation = boolean('show conversation', false) ? undefined : 'none';
return (
<Twitter
<BentoTwitter
cards={cards}
conversation={conversation}
tweetid={tweetId}
Expand All @@ -29,7 +29,7 @@ export const _default = () => {
export const moments = () => {
const limit = number('limit to', 2);
return (
<Twitter
<BentoTwitter
limit={limit}
momentid="1009149991452135424"
style={{width: '300px', height: '200px'}}
Expand All @@ -47,7 +47,7 @@ export const timelines = () => {
const timelineScreenName = 'amphtml';
const timelineUserId = '3450662892';
return (
<Twitter
<BentoTwitter
tweetLimit={tweetLimit}
timelineSourceType={timelineSourceType}
timelineScreenName={timelineScreenName}
Expand Down
20 changes: 10 additions & 10 deletions extensions/amp-twitter/1.0/test/test-component.js
@@ -1,5 +1,5 @@
import * as Preact from '#preact';
import {Twitter} from '../component';
import {BentoTwitter} from '../component';
import {WithAmpContext} from '#preact/context';
import {createRef} from '#preact';
import {mount} from 'enzyme';
Expand All @@ -9,7 +9,7 @@ import {waitFor} from '#testing/test-helper';
describes.sandboxed('Twitter preact component v1.0', {}, (env) => {
it('should render', () => {
const wrapper = mount(
<Twitter
<BentoTwitter
tweetid="1356304203044499462"
style={{
'width': '500px',
Expand All @@ -30,7 +30,7 @@ describes.sandboxed('Twitter preact component v1.0', {}, (env) => {
it('should call given requestResize', () => {
const requestResizeSpy = env.sandbox.spy();
const wrapper = mount(
<Twitter
<BentoTwitter
tweetid="1356304203044499462"
style={{
'width': '500px',
Expand Down Expand Up @@ -59,7 +59,7 @@ describes.sandboxed('Twitter preact component v1.0', {}, (env) => {

it('should change height', async () => {
const wrapper = mount(
<Twitter
<BentoTwitter
tweetid="1356304203044499462"
style={{
'width': '500px',
Expand Down Expand Up @@ -96,7 +96,7 @@ describes.sandboxed('Twitter preact component v1.0', {}, (env) => {
const ref = createRef();
const onReadyState = env.sandbox.spy();
const wrapper = mount(
<Twitter
<BentoTwitter
ref={ref}
tweetid="1356304203044499462"
style={{
Expand All @@ -121,7 +121,7 @@ describes.sandboxed('Twitter preact component v1.0', {}, (env) => {
const ref = createRef();
const wrapper = mount(
<WithAmpContext playable={true}>
<Twitter
<BentoTwitter
ref={ref}
tweetid="1356304203044499462"
style={{
Expand All @@ -144,13 +144,13 @@ describes.sandboxed('Twitter preact component v1.0', {}, (env) => {
const onErrorSpy = env.sandbox.spy();

const wrapper = mount(
<Twitter
<BentoTwitter
tweetid="1356304203044499462"
height="500"
width="500"
onLoad={onLoadSpy}
onError={onErrorSpy}
></Twitter>
></BentoTwitter>
);

const iframe = wrapper.find('iframe').getDOMNode();
Expand All @@ -169,13 +169,13 @@ describes.sandboxed('Twitter preact component v1.0', {}, (env) => {
const onLoadSpy = env.sandbox.spy();

const wrapper = mount(
<Twitter
<BentoTwitter
tweetid="00000000111111"
height="500"
width="500"
onError={onErrorSpy}
onLoad={onLoadSpy}
></Twitter>
></BentoTwitter>
);

const iframe = wrapper.find('iframe').getDOMNode();
Expand Down

0 comments on commit 1297f95

Please sign in to comment.