Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiendt committed Aug 21, 2017
1 parent c51a7aa commit 625c405
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/functional/test-amp-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ describe('3p ampcontext.js', () => {
windowPostMessageSpy = sandbox.spy();
win = {
addEventListener: (eventType, handlerFn) => {
expect(eventType).to.equal('message');
expect(windowMessageHandler).to.not.be.ok;
console.log('event type: ' + eventType);
// expect(eventType).to.equal('message');
// expect(windowMessageHandler).to.not.be.ok;
windowMessageHandler = handlerFn;
},
parent: {
Expand Down Expand Up @@ -61,6 +62,18 @@ describe('3p ampcontext.js', () => {
windowMessageHandler = undefined;
});

it.only('should call addEventListener with correct eventType', () => {
// win.addEventListener = sandbox.spy();
// expect(win.addEventListener).to.have.been.called;
// expect(win.addEventListener)
// .to.have.been.calledWith('message');

const addEventListenerSpy = sandbox.spy(win, 'addEventListener');
expect(addEventListenerSpy).to.have.been.called;
expect(addEventListenerSpy)
.to.have.been.calledWith('message');
});

it('should add metadata to window.context using name as per 3P.', () => {
win.name = generateSerializedAttributes();
const context = new AmpContext(win);
Expand Down

0 comments on commit 625c405

Please sign in to comment.