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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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>')) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
template
before dialog is shown