Skip to content

Instantly share code, notes, and snippets.

@qhwa
Created November 30, 2012 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qhwa/4174175 to your computer and use it in GitHub Desktop.
Save qhwa/4174175 to your computer and use it in GitHub Desktop.
// 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