editor.js revision e0b25dbc0322a078f384c45b48e5690f23d7eb15
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass //filter: 'DEBUG',
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass 'YUI': true,
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass}).use('console', 'test', 'editor', 'node-event-simulate', function(Y) {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass setUp : function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass tearDown : function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass test_load: function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isObject(Y.Frame, 'EditorBase was not loaded');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isObject(Y.EditorBase, 'EditorBase was not loaded');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass test_frame: function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass use: ['node','selector-css3', 'dd-drag', 'dd-ddm']
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isInstanceOf(Y.Frame, iframe, 'Iframe instance can not be created');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass this.wait(function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isTrue(iframeReady, 'IFRAME ready event did not fire');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isInstanceOf(YUI, inst, 'Internal instance not created');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isObject(inst.DD.Drag, 'DD Not loaded inside the frame');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isObject(inst.DD.DDM, 'DD Not loaded inside the frame');
e0b25dbc0322a078f384c45b48e5690f23d7eb15Dav Glass Y.Assert.isNull(Y.one('#editor iframe'), 'iframe DOM node was not destroyed');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass test_editor: function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isInstanceOf(Y.EditorBase, editor, 'EditorBase instance can not be created');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.areSame('mousedown', e.changedType, 'NodeChange working');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isTrue(e.changedNode.test('b, body'), 'Changed Node');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass this.wait(function() {
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isTrue(iframeReady, 'IFRAME ready event did not fire');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isInstanceOf(YUI, inst, 'Internal instance not created');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isObject(inst.DD.Drag, 'DD Not loaded inside the frame');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.isObject(inst.DD.DDM, 'DD Not loaded inside the frame');
fc2d50365b169f761de7a15d7a4fe406b33fd403Dav Glass Y.Assert.areSame(Y.EditorBase.FILTER_RGB(inst.one('b').getStyle('color')), '#ff0000', 'Extra CSS Failed');
e0b25dbc0322a078f384c45b48e5690f23d7eb15Dav Glass test_window: function() {
e0b25dbc0322a078f384c45b48e5690f23d7eb15Dav Glass Y.Assert.areEqual(Y.Node.getDOMNode(Y.one('#editor iframe').get('contentWindow')), Y.Node.getDOMNode(editor.getInstance().one('win')), 'Window object is not right');
e0b25dbc0322a078f384c45b48e5690f23d7eb15Dav Glass test_doc: function() {
e0b25dbc0322a078f384c45b48e5690f23d7eb15Dav Glass Y.Assert.areEqual(Y.Node.getDOMNode(Y.one('#editor iframe').get('contentWindow.document')), Y.Node.getDOMNode(editor.getInstance().one('doc')), 'Document object is not right');