jspec.jquery.js
This file
Path
spec/lib/jspec.jquery.js
79 lines · 2.3 KiB · JavaScript
Last changed by
Updated JSpecvisionmediabefore adoptiond85d834
History of this fileTake it
The walk stopped after 200 commits: lines older than 3863a76 point at it.
Merge branch 'flash'visionmediabefore adoption3863a76
lines 1–26why, one step back12// JSpec - jQuery - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)34JSpec5.requires('jQuery', 'when using jspec.jquery.js')6.include({7 name: 'jQuery',8 9 // --- Initialize10 11 init : function() {12 jQuery.ajaxSetup({ async: false })13 },14 15 // --- Utilities16 17 utilities : {18 element: jQuery,19 elements: jQuery,20 sandbox : function() {21 return jQuery('<div class="sandbox"></div>')22 }23 },24 25 // --- Matchers26 Updated JSpecvisionmediabefore adoptiond85d834
line 27why, one step back27 matchers : { Updated to JSpec 4.0.0visionmediabefore adoptionce4fe24
line 28why, one step back28 have_tag : "jQuery(expected, actual).length === 1",Merge branch 'flash'visionmediabefore adoption3863a76
lines 29–31why, one step back29 have_one : "alias have_tag",30 have_tags : "jQuery(expected, actual).length > 1",31 have_many : "alias have_tags",Updated to JSpec 4.0.0visionmediabefore adoptionce4fe24
lines 32–33why, one step back32 have_any : "alias have_tags",33 have_child : "jQuery(actual).children(expected).length === 1",Merge branch 'flash'visionmediabefore adoption3863a76
line 34why, one step back34 have_children : "jQuery(actual).children(expected).length > 1",Updated to JSpec 4.0.0visionmediabefore adoptionce4fe24
lines 35–36why, one step back35 have_text : "jQuery(actual).text() === expected",36 have_value : "jQuery(actual).val() === expected",Merge branch 'flash'visionmediabefore adoption3863a76
lines 37–38why, one step back37 be_enabled : "!jQuery(actual).attr('disabled')",38 have_class : "jQuery(actual).hasClass(expected)",Updated JSpecvisionmediabefore adoptiond85d834
lines 39–40why, one step back39 be_animated : "jQuery(actual).queue().length > 0", 40 Merge branch 'flash'visionmediabefore adoption3863a76
lines 41–49why, one step back41 be_visible : function(actual) {42 return jQuery(actual).css('display') != 'none' &&43 jQuery(actual).css('visibility') != 'hidden' &&44 jQuery(actual).attr('type') != 'hidden'45 },46 47 be_hidden : function(actual) {48 return !JSpec.does(actual, 'be_visible')49 },Updated JSpecvisionmediabefore adoptiond85d834
line 50why, one step back50 Merge branch 'flash'visionmediabefore adoption3863a76
lines 51–59why, one step back51 have_classes : function(actual) {52 return !JSpec.any(JSpec.toArray(arguments, 1), function(arg){53 return !JSpec.does(actual, 'have_class', arg)54 })55 },5657 have_attr : function(actual, attr, value) {58 return value ? jQuery(actual).attr(attr) == value:59 jQuery(actual).attr(attr)Updated JSpecvisionmediabefore adoptiond85d834
lines 60–65why, one step back60 },61 62 have_event_handlers : function(actual, expected) {63 return jQuery(actual).data('events') ?64 jQuery(actual).data('events').hasOwnProperty(expected) :65 falseMerge branch 'flash'visionmediabefore adoption3863a76
lines 66–79why, one step back66 },67 68 'be disabled selected checked' : function(attr) {69 return 'jQuery(actual).attr("' + attr + '")'70 },71 72 'have type id title alt href src sel rev name target' : function(attr) {73 return function(actual, value) {74 return JSpec.does(actual, 'have_attr', attr, value)75 }76 }77 }78})79