Skip to content

Commit

Permalink
Using jQuery#attr() now that it is working again
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 8, 2010
1 parent 545da24 commit c221de0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/assertions/should.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Assertion.prototype.one = function(selector, text){

Assertion.prototype.attr = function(key, val){
var elem = this.obj
, attr = elem.get(0).getAttribute(key);
, attr = elem.attr(key);

if (!val || (val && !this.negate)) {
this.assert(
Expand Down Expand Up @@ -146,7 +146,7 @@ Assertion.prototype.attr = function(key, val){

Assertion.prototype.class = function(name){
var elem = this.obj
, classes = elem.get(0).getAttribute('class').split(/ +/);
, classes = elem.attr('class').split(/ +/);

this.assert(
~classes.indexOf(name)
Expand Down Expand Up @@ -311,7 +311,7 @@ Assertion.prototype.value = attr('value');

Assertion.prototype.__defineGetter__('enabled', function(){
var elem = this.obj
, disabled = elem.get(0).getAttribute('disabled');
, disabled = elem.attr('disabled');

this.assert(
!disabled
Expand All @@ -330,7 +330,7 @@ Assertion.prototype.__defineGetter__('enabled', function(){

Assertion.prototype.__defineGetter__('disabled', function(){
var elem = this.obj
, disabled = elem.get(0).getAttribute('disabled');
, disabled = elem.attr('disabled');

this.assert(
disabled
Expand Down Expand Up @@ -368,11 +368,10 @@ Assertion.prototype.__defineGetter__('selected', bool('selected'));

function bool(name) {
return function(){
var elem = this.obj
, val = elem.get(0).getAttribute(name);
var elem = this.obj;

this.assert(
name == val
elem.attr(name)
, 'expected ' + j(elem) + ' to be ' + name
, 'expected ' + j(elem) + ' to not be ' + name);

Expand All @@ -391,7 +390,7 @@ function bool(name) {
function attr(name) {
return function(expected){
var elem = this.obj
, val = elem.get(0).getAttribute(name);
, val = elem.attr(name);

this.assert(
expected == val
Expand Down

0 comments on commit c221de0

Please sign in to comment.