forked from bendc/sprint
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.swp | ||
.DS_Store | ||
node_modules/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
jest.dontMock("../sprint"); | ||
|
||
describe("$('.foo').add('.bar')", function() { | ||
it('should contain .foo', function() { | ||
var $ = require("../sprint.js"); | ||
document.body.innerHTML = | ||
'<div>' + | ||
' <div class="foo"></div>' + | ||
' <div class="bar"></div>' + | ||
'</div>'; | ||
var foo = $('.foo').add('.bar').dom[0]; | ||
var foo_node = $('.foo').dom[0]; | ||
expect(foo).toBe(foo_node); | ||
}); | ||
it('should contain .bar', function() { | ||
var $ = require("../sprint.js"); | ||
document.body.innerHTML = | ||
'<div>' + | ||
' <div class="foo"></div>' + | ||
' <div class="bar"></div>' + | ||
'</div>'; | ||
var bar = $('.foo').add('.bar').dom[1]; | ||
var bar_node = $('.bar').dom[0]; | ||
expect(bar).toBe(bar_node); | ||
}); | ||
}); | ||
|
||
describe("$('#checkbox').attr('type')", function() { | ||
it('should return the value of the type attribute', function() { | ||
var $ = require("../sprint.js"); | ||
document.body.innerHTML = | ||
'<div>' + | ||
' <input id="checkbox" type="checkbox" />' + | ||
'</div>'; | ||
var input_type = $('#checkbox').attr('type'); | ||
expect(input_type).toEqual('checkbox'); | ||
}); | ||
}); | ||
|
||
describe("$('#checkbox').attr('type', 'text')", function() { | ||
it('should change the value of the type attribute to "text"', function() { | ||
var $ = require("../sprint.js"); | ||
document.body.innerHTML = | ||
'<div>' + | ||
' <input id="checkbox" type="checkbox" />' + | ||
'</div>'; | ||
var input_type = $('#checkbox').attr('type', 'text').attr('type'); | ||
expect(input_type).toEqual('text'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
"version": "0.1.0", | ||
"description": "A tiny, lightning fast jQuery-like library for modern browsers.", | ||
"main": "sprint.js", | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:philplckthun/sprint.git" | ||
|
@@ -12,5 +15,8 @@ | |
"bugs": { | ||
"url": "https://github.com/philplckthun/sprint/issues" | ||
}, | ||
"homepage": "https://github.com/philplckthun/sprint" | ||
"homepage": "https://github.com/philplckthun/sprint", | ||
"devDependencies": { | ||
"jest-cli": "^0.4.8" | ||
} | ||
} |