mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-06 06:29:11 +00:00
c472b2fe4a
ve.ui.Surface.js * Make local overlay a child of ve-ui-surface and a sibling to ve-ce-surface elements. ** This keeps local overlays relative to their surface and eliminates the need for insane z-indexes. ve.ui.PopupWidget.js * PopupWidget boundaries are now relative to ve-ce-surface and no longer protrude out ve.ce.Node.css, ve.ui.Window.css * Removal or replacement of insane z-indexes. ve.ce.FocusableNode.js, ve.ce.ProtectedNode.js, ve.ce.ResizableNode.js, ve.ui.Context.js * Translate offsets from local overlay ve.init.mw.ViewPageTarget-monobook.css, ve.init.mw.ViewPageTarget-vector.css * Skin specific z-indexes for global overlay ve.init.mw.ViewPageTarget.js * Applied direction specific mw class to ce.Surface vs ui.Surface to prevent mw content styles from being applied to ui elements. ve.ui.Dialog.css * Adjustments to surface inside of dialog so that relative offsets for local overlays can be properly calculated. ve.ui.Surface.css * Explicitly force .ve-ui-surface to be relative so that it's children can be relatively positioned. ve.ui.Widget.css * Removal of unnecessary font-size properties now that local overlay is sibling of surface. ve.js * Added get relative position helper method to translate position offsets from target parent Bug: 50241 Change-Id: Ibadce404a2286bc5dcec48f0d9da89004dbbd867
43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
/*!
|
|
* VisualEditor Element tests.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
QUnit.module( 've.Element' );
|
|
|
|
/* Tests */
|
|
|
|
QUnit.test( 'getDocument', 10, function ( assert ) {
|
|
var frameDoc, frameEl, frameDiv,
|
|
$el = $( '#qunit-fixture' ),
|
|
$div = $( '<div>' ),
|
|
el = document.getElementById( 'qunit-fixture' ),
|
|
div = document.createElement( 'div' ),
|
|
win = window,
|
|
doc = document,
|
|
frame = doc.createElement( 'iframe' );
|
|
|
|
el.appendChild( frame );
|
|
frameDoc = ( frame.contentWindow && frame.contentWindow.document ) || frame.contentDocument;
|
|
frameEl = frameDoc.createElement( 'span' );
|
|
frameDoc.documentElement.appendChild( frameEl );
|
|
frameDiv = frameDoc.createElement( 'div' );
|
|
|
|
assert.strictEqual( ve.Element.getDocument( $el ), doc, 'jQuery' );
|
|
assert.strictEqual( ve.Element.getDocument( $div ), doc, 'jQuery (detached)' );
|
|
assert.strictEqual( ve.Element.getDocument( el ), doc, 'HTMLElement' );
|
|
assert.strictEqual( ve.Element.getDocument( div ), doc, 'HTMLElement (detached)' );
|
|
assert.strictEqual( ve.Element.getDocument( win ), doc, 'Window' );
|
|
assert.strictEqual( ve.Element.getDocument( doc ), doc, 'HTMLDocument' );
|
|
|
|
assert.strictEqual( ve.Element.getDocument( frameEl ), frameDoc, 'HTMLElement (framed)' );
|
|
assert.strictEqual( ve.Element.getDocument( frameDiv ), frameDoc, 'HTMLElement (framed, detached)' );
|
|
assert.strictEqual( ve.Element.getDocument( frameDoc ), frameDoc, 'HTMLDocument (framed)' );
|
|
|
|
assert.throws( function () {
|
|
ve.Element.getDocument( {} );
|
|
}, 'Invalid' );
|
|
} );
|