| This test verifies Ctrl-D functionality, which selects next occurrence of word. |
| |
| function wordData() { |
| return { |
| original: $(".entry.original > .input").text(), |
| translation: $(".entry.translation > .input").text(), |
| tags: $(".active-tags > .tagcloud > .tag").toArray().map(function(value) { return value.textContent; }) |
| }; |
| } |
| |
| function submitWord(url) { |
| var stub = new App.Stub($(".content")); |
| $.post(url, wordData()) |
| .done(function() { |
| var callback = $("meta[data-callback]").attr("data-callback"); |
| if (callback) { |
| window.location = callback; |
| } else { |
| stub.success(); |
| $(".entry.original > .input").text("").focus(); |
| $(".entry.translation > .input").text(""); |
| } |
| }) |
| .fail(function(obj, err, errDescr) { |
| stub.failure("Error: " + errDescr); |
| }) |
| } |
| |
| Running: testCursorInTheWordStart |
| 'function': 1 |
| |
| Running: testCursorInTheWordEnd |
| 'function': 1 |
| |
| Running: testNonWordSelection |
| '$(': 7 |
| |
| Running: testNonWordSelection2 |
| ' > ': 6 |
| |
| Running: testNonWordSelection3 |
| 'window.location': 1 |
| 'success': 1 |
| 'text(': 1 |
| |
| Running: testNonWordSelection4 |
| 'text(': 4 |
| 'dow.locati': 1 |
| 'es': 1 |
| |
| Running: testTriggerWordSearchInMixedCase |
| 'stub = new App.Stub': 1 |
| 'callback': 5 |
| |