Ticket #3139: test-element-focusNext.patch

File test-element-focusNext.patch, 2.3 KB (added by Garry Yao, 15 years ago)
  • _source/tests/core/dom/element_focus1.html

     
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2<html xmlns="http://www.w3.org/1999/xhtml">
     3<head>
     4        <title>CKEDITOR.dom.element</title>
     5        <link rel="stylesheet" type="text/css" href="../../test.css" />
     6        <script type="text/javascript" src="../../../../ckeditor_source.js"></script> <!-- %REMOVE_LINE%
     7        <script type="text/javascript" src="../../../ckeditor.js"></script>
     8        %REMOVE_LINE% -->
     9        <script type="text/javascript" src="../../test.js"></script>
     10        <script type="text/javascript">
     11        //<![CDATA[
     12
     13CKEDITOR.plugins.load( [ 'tab' ] );
     14
     15CKEDITOR.test.addTestCase( (function()
     16{
     17        // Local reference to the "assert" object.
     18        var assert = CKEDITOR.test.assert;
     19
     20        return {
     21               
     22                /**
     23                 *  An element following this element with the lowest tabindex
     24                 *      that is higher than this element tabindex.
     25                 */
     26                test_focusNext2 : function()
     27                {
     28                        var start = CKEDITOR.document.getById( 'focus2' ),
     29                                end = CKEDITOR.document.getById( 'focus4' ),
     30                                isFocused = false;
     31                        end.on( 'focus', function(){
     32                                isFocused = true;
     33                        } )
     34                        start.focusNext();
     35                       
     36                        this.wait( function(){
     37                                assert.isTrue( isFocused );
     38                        }, 500 );
     39                },
     40
     41                name : document.title
     42        };
     43})() );
     44
     45        //]]>
     46        </script>
     47</head>
     48<body>
     49<textarea id="focusTarget1" style="display:none"></textarea>
     50<a href="#" id="focusTarget2" style="visibility:hidden"></a>
     51<span id="focusTarget3" tabindex="-1">text</span>
     52<form    id="focusTarget4" >text</form>
     53<form    id="focusTarget5" >
     54        <fieldset>
     55                <label><input id="focus1" type="button"></input></label>
     56                <label><input id="focus2" type="text" ></input></label>
     57                <label><input  id="focus3" type="textarea" tabindex="-1"></input></label>
     58                <label><input  id="focus4" type="checkbox" tabindex="1"></input></label>
     59                <label><input  id="focus5" type="radio" tabindex="3"></input></label>
     60                <label><input type="hidden"></input></label>
     61                <label><input  id="focus6" type="radio" tabindex="2"></input></label>
     62        </fieldset>
     63</form>
     64</body>
     65</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy