Created
November 30, 2012 06:47
-
-
Save qhwa/4174175 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// file: test/grunt-demo_test.js | |
module('jQuery#ali-link', { | |
setup: function() { | |
this.elems = $('#qunit-fixture').children(); | |
} | |
}); | |
test('is chainable', 1, function() { | |
strictEqual(this.elems.alilink(), this.elems, 'should be chaninable'); | |
}); | |
test('can select', function() { | |
equal( $('a:alilink', $('#qunit-fixture')).length, 3, | |
'should select links with alibaba domain' | |
); | |
}); | |
test('add icon to alibaba links', function() { | |
this.elems.alilink(); | |
this.elems.each(function(){ | |
var self = $(this); | |
if( /^http:\/\/((.+)\.)?alibaba\.com/.test(this.href) ) { | |
ok(self.hasClass('ali-link')); | |
} else { | |
ok(!self.hasClass('ali-link')); | |
} | |
}); | |
}); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment