diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js')
-rw-r--r-- | extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js | 219 |
1 files changed, 114 insertions, 105 deletions
diff --git a/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js b/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js index 69fe2905..d4ffe5ae 100644 --- a/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js +++ b/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js @@ -4,9 +4,9 @@ var textareaId = '#wpTextbox1'; var wikiEditorTests = { // Add emoticons section - 'add_sections_toolbar': { - 'call': 'addToToolbar', - 'data': { + add_sections_toolbar: { + call: 'addToToolbar', + data: { 'sections': { 'emoticons': { 'type': 'toolbar', @@ -14,30 +14,30 @@ var wikiEditorTests = { } } }, - 'test': '*[rel=emoticons].section', - 'pre': 0, - 'post': 1 + test: '*[rel=emoticons].section', + pre: 0, + post: 1 }, // Add faces group to emoticons section 'add_groups': { - 'call': 'addToToolbar', - 'data': { - 'section': 'emoticons', + call: 'addToToolbar', + data: { + section: 'emoticons', 'groups': { 'faces': { 'label': 'Faces' } } }, - 'test': '*[rel=emoticons].section *[rel=faces].group', - 'pre': 0, - 'post': 1 + test: '*[rel=emoticons].section *[rel=faces].group', + pre: 0, + post: 1 }, // Add smile tool to faces group of emoticons section 'add_tools': { - 'call': 'addToToolbar', - 'data': { - 'section': 'emoticons', + call: 'addToToolbar', + data: { + section: 'emoticons', 'group': 'faces', 'tools': { 'smile': { @@ -47,20 +47,20 @@ var wikiEditorTests = { action: { type: 'encapsulate', options: { - pre: ":)" + pre: ':)' } } } } }, - 'test': '*[rel=emoticons].section *[rel=faces].group *[rel=smile].tool', - 'pre': 0, - 'post': 1 + test: '*[rel=emoticons].section *[rel=faces].group *[rel=smile].tool', + pre: 0, + post: 1 }, // Add info section 'add_sections_booklet': { - 'call': 'addToToolbar', - 'data': { + call: 'addToToolbar', + data: { 'sections': { 'info': { 'type': 'booklet', @@ -68,16 +68,16 @@ var wikiEditorTests = { } } }, - 'test': '*[rel=info].section', - 'pre': 0, - 'post': 1 + test: '*[rel=info].section', + pre: 0, + post: 1 }, // Add info section 'add_pages_table': { - 'call': 'addToToolbar', - 'data': { - 'section': 'info', - 'pages': { + call: 'addToToolbar', + data: { + section: 'info', + pages: { 'colors': { 'layout': 'table', 'label': 'Colors', @@ -89,44 +89,44 @@ var wikiEditorTests = { } } }, - 'test': '*[rel=info].section *[rel=colors].page', - 'pre': 0, - 'post': 1 + test: '*[rel=info].section *[rel=colors].page', + pre: 0, + post: 1 }, // Add colors rows 'add_rows': { - 'call': 'addToToolbar', - 'data': { - 'section': 'info', - 'page': 'colors', + call: 'addToToolbar', + data: { + section: 'info', + page: 'colors', 'rows': [ { 'name': { text: 'Red' }, 'temp': { text: 'Warm' }, - 'swatch': { html: '<div style="width:10px;height:10px;background-color:red;">' } + 'swatch': { html: '<div style="width: 10px; height: 10px; background-color: red;">' } }, { 'name': { text: 'Blue' }, 'temp': { text: 'Cold' }, - 'swatch': { html: '<div style="width:10px;height:10px;background-color:blue;">' } + 'swatch': { html: '<div style="width: 10px; height: 10px; background-color: blue;">' } }, { 'name': { text: 'Silver' }, 'temp': { text: 'Neutral' }, - 'swatch': { html: '<div style="width:10px;height:10px;background-color:silver;">' } + 'swatch': { html: '<div style="width: 10px; height: 10px; background-color: silver;">' } } ] }, - 'test': '*[rel=info].section *[rel=colors].page tr td', - 'pre': 0, - 'post': 9 + test: '*[rel=info].section *[rel=colors].page tr td', + pre: 0, + post: 9 }, // Add 'add_pages_characters': { - 'call': 'addToToolbar', - 'data': { - 'section': 'info', - 'pages': { + call: 'addToToolbar', + data: { + section: 'info', + pages: { 'emoticons': { 'layout': 'characters', 'label': 'Emoticons' @@ -137,110 +137,119 @@ var wikiEditorTests = { } } }, - 'test': '*[rel=info].section *[rel=emoticons].page', - 'pre': 0, - 'post': 1 + test: '*[rel=info].section *[rel=emoticons].page', + pre: 0, + post: 1 }, // Add 'add_characters': { - 'call': 'addToToolbar', - 'data': { - 'section': 'info', - 'page': 'emoticons', - 'characters': [ ':)', ':))', ':(', '<3', ';)' ] + call: 'addToToolbar', + data: { + section: 'info', + page: 'emoticons', + characters: [ ':)', ':))', ':(', '<3', ';)' ] }, - 'test': '*[rel=info].section *[rel=emoticons].page *[rel=":)"]', - 'pre': 0, - 'post': 1 + test: '*[rel=info].section *[rel=emoticons].page *[rel=":)"]', + pre: 0, + post: 1 }, // Remove page 'remove_page': { - 'call': 'removeFromToolbar', - 'data': { - 'section': 'info', - 'page': 'removeme' + call: 'removeFromToolbar', + data: { + section: 'info', + page: 'removeme' }, - 'test': '*[rel=info].section *[rel=removeme].page', - 'pre': 1, - 'post': 0 + test: '*[rel=info].section *[rel=removeme].page', + pre: 1, + post: 0 }, // Remove :)) from emoticon characters 'remove_character': { - 'call': 'removeFromToolbar', - 'data': { - 'section': 'info', - 'page': 'emoticons', + call: 'removeFromToolbar', + data: { + section: 'info', + page: 'emoticons', 'character': ':))' }, - 'test': '*[rel=info].section *[rel=emoticons].page *[rel=":))"]', - 'pre': 1, - 'post': 0 + test: '*[rel=info].section *[rel=emoticons].page *[rel=":))"]', + pre: 1, + post: 0 }, // Remove row from colors table of info section 'remove_row': { - 'call': 'removeFromToolbar', - 'data': { - 'section': 'info', - 'page': 'colors', + call: 'removeFromToolbar', + data: { + section: 'info', + page: 'colors', 'row': 0 }, - 'test': '*[rel=info].section *[rel=colors].page tr td', - 'pre': 9, - 'post': 6 + test: '*[rel=info].section *[rel=colors].page tr td', + pre: 9, + post: 6 } }; -$(document).ready( function() { - var button = $( '<button>Run wikiEditor Tests!</button>' ) + +jQuery(document).ready( function ( $ ) { + var $button = $( '<button>Run wikiEditor Tests!</button>' ) .css( { - 'position': 'fixed', - 'bottom': 0, - 'right': 0, - 'width': '100%', - 'backgroundColor': '#333333', - 'opacity': 0.75, - 'color': '#DDDDDD', - 'padding': '0.5em', - 'border': 'none', - 'display': 'none' + position: 'fixed', + bottom: 0, + right: 0, + width: '100%', + backgroundColor: '#333', + opacity: 0.75, + color: '#DDDDDD', + padding: '0.7em', + border: 'none', + display: 'none', + cursor: 'pointer' } ) - .click( function() { - if ( $(this).attr( 'enabled' ) == 'false' ) { + .click( function () { + if ( $(this).data( 'testDone' ) ) { $(this).slideUp( 'fast' ); return false; } - var messages = [ 'Running tests for wikiEditor API' ]; - var $target = $( textareaId ); - var $ui = $target.data( 'wikiEditor-context' ).$ui; - var passes = 0; - var tests = 0; - for ( var test in wikiEditorTests ) { - var pre = $ui.find( wikiEditorTests[test].test ).size() == - wikiEditorTests[test].pre; + + var test, pre, post, + messages = [ 'Running tests for wikiEditor API' ], + $target = $( textareaId ), + $ui = $target.data( 'wikiEditor-context' ).$ui, + passes = 0, + tests = 0; + + for ( test in wikiEditorTests ) { + pre = $ui.find( wikiEditorTests[test].test ).length === wikiEditorTests[test].pre; messages.push ( test + '-pre: ' + ( pre ? 'PASS' : 'FAIL' ) ); $target.wikiEditor( wikiEditorTests[test].call, wikiEditorTests[test].data ); - var post = $ui.find( wikiEditorTests[test].test ).size() == - wikiEditorTests[test].post; + post = $ui.find( wikiEditorTests[test].test ).length === wikiEditorTests[test].post; messages.push ( test + '-post: ' + ( post ? 'PASS' : 'FAIL' ) ); if ( pre && post ) { passes++; } tests++; } - if ( window.console !== undefined ) { + + if ( window.console ) { for ( var i = 0; i < messages.length; i++ ) { - console.log( messages[i] ); + window.console.log( messages[i] ); } } + $(this) .attr( 'title', messages.join( " | " ) ) .text( passes + ' / ' + tests + ' were successful' ) .css( 'backgroundColor', passes < tests ? 'red' : 'green' ) - .attr( 'enabled', 'false' ) + .data( 'testDone', 'true' ) .blur(); } ) .appendTo( $( 'body' ) ); - setTimeout( function() { button.slideDown( 'fast' ) }, 2000 ); + + setTimeout( function () { + $button.slideDown( 'fast' ); + }, 1500 ); + } ); |