Permalink
Browse files

unit tests for features

  • Loading branch information...
1 parent 3fe11df commit 21f638ef9eccc351b075f6b7a56070b2cfd66899 @josh josh committed May 31, 2010
Showing with 28 additions and 3 deletions.
  1. +0 −1 src/wysihat/features.js
  2. +21 −0 test/unit/features_test.js
  3. +3 −0 test/unit/fixtures/features.html
  4. +4 −2 test/unit/templates/default.erb
View
@@ -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
@@ -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);
+ }
+});
@@ -0,0 +1,3 @@
+<script type="text/javascript">
+ WysiHat.BrowserFeatures.run();
+</script>
@@ -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>

0 comments on commit 21f638e

Please sign in to comment.