Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unit tests for features

  • Loading branch information...
commit 21f638ef9eccc351b075f6b7a56070b2cfd66899 1 parent 3fe11df
@josh josh authored
View
1  src/wysihat/features.js
@@ -49,7 +49,6 @@ WysiHat.BrowserFeatures = (function() {
function detectIndentType(document) {
document.body.innerHTML = 'tab';
document.execCommand('indent', false, null);
- console.log(document.body.innerHTML);
var tagName;
element = document.body.childNodes[0];
View
21 test/unit/features_test.js
@@ -0,0 +1,21 @@
+new Test.Unit.Runner({
+ testDetectParagraphType: function() {
+ var runner = this;
+
+ if (Prototype.Browser.WebKit)
+ runner.assertEqual("div", WysiHat.BrowserFeatures.paragraphType);
+ else if (Prototype.Browser.Gecko)
+ runner.assertEqual("br", WysiHat.BrowserFeatures.paragraphType);
+ else if (Prototype.Browser.IE)
+ runner.assertEqual("p", WysiHat.BrowserFeatures.paragraphType);
+ },
+
+ testDetectIndentType: function() {
+ var runner = this;
+
+ if (Prototype.Browser.WebKit || Prototype.Browser.IE)
+ runner.assertEqual(true, WysiHat.BrowserFeatures.indentInsertsBlockquote);
+ else if (Prototype.Browser.Gecko)
+ runner.assertEqual(false, WysiHat.BrowserFeatures.indentInsertsBlockquote);
+ }
+});
View
3  test/unit/fixtures/features.html
@@ -0,0 +1,3 @@
+<script type="text/javascript">
+ WysiHat.BrowserFeatures.run();
+</script>
View
6 test/unit/templates/default.erb
@@ -4,9 +4,11 @@
<title>Unit test file | <%= title %> | <%= template_name %> template | <%= timestamp %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<%= lib_files %>
+ <script src="assets/prototype.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/wysihat.js" type="text/javascript" charset="utf-8"></script>
<%= css_fixtures %>
- <%= js_fixtures %>
+ <%#= js_fixtures %>
+ <script src="lib_assets/unittest.js" type="text/javascript" charset="utf-8"></script>
<%= test_file %>
</head>
<body>
@@ -17,4 +19,4 @@
<%= html_fixtures %>
</body>
-</html>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.