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

Subscriptions: dialog re-renderer #14076

Merged
merged 5 commits into from Mar 19, 2018

Conversation

prateekbh
Copy link
Member

  • re-renders actions inside dialog template before dialog is shown

Copy link
Contributor

@dvoytenko dvoytenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Just a few requests.

@@ -51,29 +51,40 @@ export class LocalSubscriptionPlatformRenderer {
}

/**
*
* @param {!Node} rootNode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used as far as I can tell?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


beforeEach(() => {
win = env.win;
doc = win.document;
ampdoc = env.ampdoc;
templatesMock = sandbox.mock(Services.templatesFor(win));
actionRendererStub = sandbox.stub(LocalRenderer, 'renderActions').callsFake(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this will actually work as a testing in all cases. The module stubbing is not possible. I think you need to re-factor it as a separate API on the instance of Renderer class and pass that instance to the dialog renderer. Then you can easily stub it here.

Copy link
Member Author

@prateekbh prateekbh Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combined both files and worked

@@ -110,6 +110,9 @@ const WHITELISTED_ATTRS = [
/* Attributes added for amp-bind */
// TODO(kmh287): Add more whitelisted attributes for bind?
'text',
/* Attributes for amp-subscriptions */
'subscriptions-action',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need subscriptions-actions and subscriptions-display, right?

Can you please also add a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, Done and added the test

Copy link
Contributor

@dvoytenko dvoytenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one more request

.to.equal('<div subscriptions-section="actions">link</div>');
expect(sanitizeHtml('<div subscriptions-actions="">link</div>'))
.to.equal('<div subscriptions-actions="">link</div>');
expect(sanitizeHtml('<div subscriptions-display="">link</div>'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add one more with some value for subscriptions-dialog attribute.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@prateekbh prateekbh merged commit 19bc1f9 into ampproject:master Mar 19, 2018
@prateekbh prateekbh deleted the dialog-rerendering branch March 19, 2018 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants