Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/timocratic/screw-unit into …

…timocratic/master
  • Loading branch information...
commit 3a278fe4cedadb57ef125bea3419d57a083b4c07 2 parents d31f573 + b4a4915
Nick Kallen authored
Showing with 140 additions and 90 deletions.
  1. +50 −0 base_example.html
  2. +2 −2 lib/screw.builder.js
  3. +88 −88 lib/screw.css
View
50 base_example.html
@@ -0,0 +1,50 @@
+<html>
+ <head>
+ <script src="lib/jquery-1.2.3.js"></script>
+ <script src="lib/jquery.fn.js"></script>
+ <script src="lib/jquery.print.js"></script>
+ <script src="lib/screw.builder.js"></script>
+ <script src="lib/screw.matchers.js"></script>
+ <script src="lib/screw.events.js"></script>
+ <script src="lib/screw.behaviors.js"></script>
+ <link rel="stylesheet" href="lib/screw.css">
+ <script type="text/javascript">
+ //Here be your code. Would likely be an external .js file.
+ function foo(){
+ return "bar";
+ }
+ </script>
+
+ <script type="text/javascript">
+ //Here be your custom matchers. Would likely be in an external file?
+ //This is a sketchy example it actually chokes, but the browser returns
+ //its own error message. This means the to_not case doesn't work.
+ Screw.Matchers["be_defined"] = {
+ match: function(expected, actual) {
+ return typeof actual != "undefined"
+ },
+ failure_message: function(expected, actual, not) {
+ return ''//No point in getting fancy, browser returns own message.
+ }
+ }
+ //Here be your specs/behaviors. Would likely be in an external file?
+ //See the full self-speccing suite.html for detailed example.
+ Screw.Unit(function() {
+ describe("foo", function() {
+ it("is defined", function() {
+ expect(foo).to(be_defined);
+ });
+ it("returns bar", function() {
+ expect(foo()).to(equal, "bar");
+ });
+ });
+ describe("baz", function() {
+ it("is not defined", function() {
+ expect(baz).to(be_defined);
+ });
+ });
+ });
+ </script>
+ </head>
+ <body></body>
+</html>
View
4 lib/screw.builder.js
@@ -19,7 +19,7 @@ var Screw = (function($) {
describe: function(name, fn) {
var describe = $('<li class="describe">');
- $('<h1>').text(name).appendTo(describe);
+ describe.append('<h1>' + name + '</h1>');
describe
.append('<ol class="befores">')
.append('<ul class="its">')
@@ -37,7 +37,7 @@ var Screw = (function($) {
it: function(name, fn) {
var it = $('<li class="it">');
- $('<h2>').text(name).appendTo(it);
+ it.append('<h2>' + name + '</h2>')
it.data('screwunit.run', fn);
this.context[this.context.length-1]
View
176 lib/screw.css
@@ -3,91 +3,91 @@ html {
font-family: Georgia, serif;
background: #EDEBD5;
}
-
- li {
- list-style-type: none;
- }
-
- .focused {
- background-color: #F4F2E4;
- }
-
- .focused * {
- opacity: 1.0;
- }
-
- h1, h2, p {
- opacity: 0.4;
- }
-
- .describes {
- padding-left: 0;
- }
-
- .describes h1 {
- font-size: 1.1em;
- color: #877C21;
- line-height: 1.8em;
- margin: 0pt 0pt 0.6em;
- border-bottom: 1px solid transparent;
- }
-
- .describes h1:hover {
- cursor: pointer;
- color: #000;
- background-color: #F4F2E4;
- border-bottom: 1px solid #9A8E51;
- }
-
- .describes .describe {
- margin-left: 0.6em;
- padding-left: 0.6em;
- border: 1px dashed grey;
- }
-
- .describes .describe .its {}
-
- .describes .describe .its .it {
- list-style-type: lower-roman;
- list-style-position: outside;
- }
-
- .describes .describe .its .it h2 {
- font-weight: normal;
- font-style: italic;
- padding-left: 0.5em;
- }
-
- .describes .describe .its .it.enqueued h2 {
- background-color: #CC6600;
- color: white;
- }
-
- .describes .describe .its .it.passed h2 {
- background-color: #5A753D;
- color: white;
- }
-
- .describes .describe .its .it.failed h2 {
- background-color: #993300;
- color: white;
- }
-
- .describes .describe .its .it.failed p {
- margin-left: 1em;
- color: #993300;
- }
-
- .describes .describe .its .it h2 {
- font-size: 1.0em;
- color: #877C21;
- line-height: 1.8em;
- margin: 0 0 0.5em;
- border-bottom: 1px solid transparent;
- }
-
- .describes .describe .its .it h2:hover {
- cursor: pointer;
- color: #000;
- border-bottom: 1px solid #9A8E51;
- }
+
+li {
+ list-style-type: none;
+}
+
+.focused {
+ background-color: #F4F2E4;
+}
+
+.focused * {
+ opacity: 1.0;
+}
+
+h1, h2, p {
+ opacity: 0.4;
+}
+
+.describes {
+ padding-left: 0;
+}
+
+.describes h1 {
+ font-size: 1.1em;
+ color: #877C21;
+ line-height: 1.8em;
+ margin: 0pt 0pt 0.6em;
+ border-bottom: 1px solid transparent;
+}
+
+.describes h1:hover {
+ cursor: pointer;
+ color: #000;
+ background-color: #F4F2E4;
+ border-bottom: 1px solid #9A8E51;
+}
+
+.describes .describe {
+ margin-left: 0.6em;
+ padding-left: 0.6em;
+ border: 1px dashed grey;
+}
+
+.describes .describe .its {}
+
+.describes .describe .its .it {
+ list-style-type: lower-roman;
+ list-style-position: outside;
+}
+
+.describes .describe .its .it h2 {
+ font-weight: normal;
+ font-style: italic;
+ padding-left: 0.5em;
+}
+
+.describes .describe .its .it.enqueued h2 {
+ background-color: #CC6600;
+ color: white !important;
+}
+
+.describes .describe .its .it.passed h2 {
+ background-color: #5A753D;
+ color: white !important;
+}
+
+.describes .describe .its .it.failed h2 {
+ background-color: #993300;
+ color: white !important;
+}
+
+.describes .describe .its .it.failed p {
+ margin-left: 1em;
+ color: #993300;
+}
+
+.describes .describe .its .it h2 {
+ font-size: 1.0em;
+ color: #877C21;
+ line-height: 1.8em;
+ margin: 0 0 0.5em;
+ border-bottom: 1px solid transparent;
+}
+
+.describes .describe .its .it h2:hover {
+ cursor: pointer;
+ color: #000;
+ border-bottom: 1px solid #9A8E51;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.