From cf51cd9089cb7902dbfd207c258dc4a229703d05 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Tue, 27 Sep 2016 22:33:27 -0700 Subject: [PATCH] [fbjs] Test getActiveElement api change (#156) --- .../src/core/dom/__tests__/getActiveElement-test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/fbjs/src/core/dom/__tests__/getActiveElement-test.js b/packages/fbjs/src/core/dom/__tests__/getActiveElement-test.js index 99b8cc78..8601810f 100644 --- a/packages/fbjs/src/core/dom/__tests__/getActiveElement-test.js +++ b/packages/fbjs/src/core/dom/__tests__/getActiveElement-test.js @@ -19,4 +19,17 @@ describe('getActiveElement', () => { var element = getActiveElement(); expect(element.tagName).toEqual('BODY'); }); + + it('uses optional document parameter when provided', () => { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + var iframeDocument = iframe.contentDocument; + var element = getActiveElement(iframeDocument); + try { + expect(element.ownerDocument).toBe(iframeDocument); + expect(element.ownerDocument).not.toBe(document); + } finally { + document.body.removeChild(iframe); + } + }); });