Created
December 24, 2010 02:28
-
-
Save juno/753818 to your computer and use it in GitHub Desktop.
Jasmineによるdocument.getElementByIdのテスト
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
/** | |
* Document クラスのテスト | |
*/ | |
describe('Document オブジェクトは', function() { | |
it('getElementById メソッドで特定の ID を持つ DOM オブジェクトを取得する事ができる', function() { | |
var elementId = 'test-node'; | |
expect(document.getElementById(elementId)).not.toBeNull(); | |
}); | |
}); |
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
/** | |
* Document クラスのテスト | |
*/ | |
describe('Document オブジェクトは', function() { | |
var container = null; | |
beforeEach(function() { | |
container = document.createElement('div'); | |
container.id = 'test-node'; | |
document.body.appendChild(container); | |
}); | |
afterEach(function() { | |
document.body.removeChild(container); | |
container = null; | |
}); | |
it('getElementById メソッドで特定の ID を持つ DOM オブジェクトを取得する事ができる', function() { | |
var elementId = 'test-node'; | |
expect(document.getElementById(elementId)).not.toBeNull(); | |
}); | |
}); |
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
/** | |
* Document クラスのテスト | |
*/ | |
describe('Document オブジェクトは', function() { | |
beforeEach(function() { | |
setFixtures('<div id="test-node"></div>'); | |
}); | |
it('getElementById メソッドで特定の ID を持つ DOM オブジェクトを取得する事ができる', function() { | |
var elementId = 'test-node'; | |
expect(document.getElementById(elementId)).not.toBeNull(); | |
}); | |
}); |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>Jasmine Test Runner</title> | |
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.0.1/jasmine.css"> | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script> | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script> | |
<!-- include spec files here... --> | |
<script type="text/javascript" src="spec/SpecHelper.js"></script> | |
<script type="text/javascript" src="spec/DocumentSpec.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
jasmine.getEnv().addReporter(new jasmine.TrivialReporter()); | |
jasmine.getEnv().execute(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment