Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
7 changes: 3 additions & 4 deletions extensions/amp-story/1.0/amp-story.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ amp-story {
touch-action: manipulation !important;
}

html.i-amphtml-story-standalone {
html:root {
font-size: calc(2.5 * var(--story-page-vmax, 8px));
}

html.i-amphtml-story-standalone,
html.i-amphtml-story-standalone body {
html:root, html:root body {
font-size: calc(2.5 * var(--story-page-vh, 8px));
height: 100% !important;
margin: 0 !important;
Expand Down Expand Up @@ -120,7 +119,7 @@ h6 {
font-size: 0.67rem;
}

html.i-amphtml-story-standalone #i-amphtml-wrapper body {
html:root #i-amphtml-wrapper body {
/** AMP runtime adds a 1px border on iOS iframes, causing the body to be
1px bigger than the viewport. */
border-top: none !important;
Expand Down
2 changes: 0 additions & 2 deletions extensions/amp-story/1.0/amp-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,6 @@ export class AmpStory extends AMP.BaseElement {
* @private
*/
initializeStandaloneStory_() {
const html = this.win.document.documentElement;
html.classList.add('i-amphtml-story-standalone');
// Lock body to prevent overflow.
this.lockBody_();
// Standalone CSS affects sizing of the entire page.
Expand Down
10 changes: 5 additions & 5 deletions extensions/amp-story/1.0/test/test-amp-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {createElementWithAttributes} from '#core/dom';
import {registerServiceBuilder} from '../../../../src/service-helpers';
import {toggleExperiment} from '#experiments';
import {waitFor} from '#testing/test-helper';
import {setImportantStyles} from '#core/dom/style';

// Represents the correct value of KeyboardEvent.which for the Right Arrow
const KEYBOARD_EVENT_WHICH_RIGHT_ARROW = 39;
Expand Down Expand Up @@ -116,6 +117,10 @@ describes.realWin(
});

AmpStory.isBrowserSupported = () => true;

// Fakes the size of amp-story so it's not built/laid out until we call build/layoutCallbacks
// allowing us to mock function calls before the lifecycle callbacks.
setImportantStyles(win.document.documentElement, {'height': 'auto'});
});

afterEach(() => {
Expand All @@ -131,7 +136,6 @@ describes.realWin(

it('should activate the first page when built', async () => {
await createStoryWithPages(2, ['cover', 'page-1']);

await story.layoutCallback();
// Getting all the AmpStoryPage objets.
const pageElements = story.element.getElementsByTagName('amp-story-page');
Expand Down Expand Up @@ -161,7 +165,6 @@ describes.realWin(
await createStoryWithPages(2);

const buildShareMenuStub = env.sandbox.stub(story.shareMenu_, 'build');

await story.layoutCallback();
expect(buildShareMenuStub).to.have.been.calledOnce;
});
Expand All @@ -183,7 +186,6 @@ describes.realWin(

it('should pause/resume pages when switching pages', async () => {
await createStoryWithPages(2, ['cover', 'page-1']);

await story.layoutCallback();
// Getting all the AmpStoryPage objects.
const pageElements = story.element.getElementsByTagName('amp-story-page');
Expand Down Expand Up @@ -235,7 +237,6 @@ describes.realWin(

it('lock body when amp-story is initialized', async () => {
await createStoryWithPages(2, ['cover', 'page-1']);

await story.layoutCallback();
story.lockBody_();
expect(win.document.body.style.getPropertyValue('overflow')).to.be.equal(
Expand All @@ -248,7 +249,6 @@ describes.realWin(

it('checks if pagination buttons exist ', async () => {
await createStoryWithPages(2, ['cover', 'page-1']);

await story.layoutCallback();
expect(
story.element.querySelectorAll('.i-amphtml-story-button-container')
Expand Down