Skip to content

Commit 1e0711e

Browse files
committed
-- updated the testing framework for integration tests, Readme to reflect as much --
1 parent d80194c commit 1e0711e

24 files changed

+121
-147
lines changed

README.rdoc

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Very easy. Just link add a script element pointing to the library, and a link e
1414
<script src="./sassijs.js" type="text/javascript"></script>
1515
<link href="./main.sass" type="text/sass" />
1616

17+
== Tests
18+
19+
Had to twist qUnit to get the testing framework that I wanted, because I needed to be able to run individual unit tests. You can access the test suite at:
20+
21+
.../sassijs/test/index.html
22+
1723
== Status
1824

1925
This software is currently at version 0.437, which is alpha-quality. When it hits 1.0, it will be feature complete with the SASS specifications that make sense outside of Ruby, and it will be cross-browser compatible up to jquery's standards.

lib/sassijs.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ Sassijs.method( 'determineTree', function(){
1818
this.tree = new SassijsTree( this.getTemplate() );
1919
});
2020

21+
Sassijs.method( 'getCss', function(){
22+
return this.getTree().getRoot().getCss().join( '\n' );
23+
});
24+
2125
Sassijs.method( 'getStyleElement', function(){
22-
return '<style type="text/css"><!--\n' + this.getTree().getRoot().getCss().join( '\n' ) + '\n--></style>';
26+
return '<style type="text/css"><!--\n' + this.getCss() + '\n--></style>';
2327
});
2428

2529
Sassijs.method( 'writeToDocument', function(){

test/autoloader.qunit

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml" >
33
<head>
4-
<title>Sassij Engine Tests</title>
4+
<title>Sassijs Tests</title>
55
<script language="javascript" src="jquery-1.3.1.min.js" type="text/javascript"></script>
66
<script language="javascript" src="testrunner.js" type="text/javascript"></script>
77
<script language="javascript" src="testnavigation.js" type="text/javascript"></script>
@@ -21,10 +21,8 @@
2121

2222
</script>
2323

24-
<h1>Shared Tests</h1>
25-
<h2 id="banner">
26-
<select id='test_select'></select>
27-
</h2>
24+
<h1></h1>
25+
<h2 id="banner"></h2>
2826
<ol id="tests"></ol>
2927
<div id="results"></div>
3028
<div id="main"></div>

test/helper.qunit

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml" >
33
<head>
4-
<title>Sassij Engine Tests</title>
4+
<title>Sassijs Engine Tests</title>
55
<script language="javascript" src="jquery-1.3.1.min.js" type="text/javascript"></script>
66
<script language="javascript" src="testrunner.js" type="text/javascript"></script>
77
<script language="javascript" src="testnavigation.js" type="text/javascript"></script>
@@ -27,10 +27,8 @@
2727

2828
</script>
2929

30-
<h1>Shared Tests</h1>
31-
<h2 id="banner">
32-
<select id='test_select'></select>
33-
</h2>
30+
<h1></h1>
31+
<h2 id="banner"></h2>
3432
<ol id="tests"></ol>
3533
<div id="results"></div>
3634
<div id="main"></div>

test/index.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml" >
33
<head>
4-
<title>Sassij Engine Tests</title>
4+
<title>Sassijs Tests</title>
55
<script language="javascript" src="jquery-1.3.1.min.js" type="text/javascript"></script>
66
<script language="javascript" src="testrunner.js" type="text/javascript"></script>
77
<script language="javascript" src="testnavigation.js" type="text/javascript"></script>
@@ -13,10 +13,8 @@
1313

1414

1515
</script>
16-
<h1>Sassijs Tests</h1>
17-
<h2 id="banner">
18-
<select id='test_select'></select>
19-
</h2>
16+
<h1></h1>
17+
<h2 id="banner"></h2>
2018
<script language="javascript" type="text/javascript">
2119
</script>
2220
<ol id="tests"></ol>

test/integrations.qunit

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml" >
3+
<head>
4+
<title>Sassijs Tests</title>
5+
<script language="javascript" src="jquery-1.3.1.min.js" type="text/javascript"></script>
6+
<script language="javascript" src="testrunner.js" type="text/javascript"></script>
7+
<script language="javascript" src="testnavigation.js" type="text/javascript"></script>
8+
<link media="screen" href="testsuite.css" type="text/css" rel="stylesheet"/>
9+
<script language="javascript" src="testsetup.js" type="text/javascript"></script>
10+
</head>
11+
<body>
12+
<script language="javascript" type="text/javascript">
13+
14+
template = document.location.toString().split( "#" )[1];
15+
16+
module( "Integration Test for " + template + " Template");
17+
18+
test( "should compare sass template with corresponding css file", function(){
19+
sassijs = new SassijsFile( '../templates/' + template + '.sass', false );
20+
var css = $.ajax({
21+
url: '../templates/' + template + '.css',
22+
async: false
23+
}).responseText;
24+
equals( sassijs.getCss(), css );
25+
});
26+
27+
</script>
28+
29+
<h1></h1>
30+
<h2 id="banner"></h2>
31+
<ol id="tests"></ol>
32+
<div id="results"></div>
33+
<div id="main"></div>
34+
35+
</body>
36+
</html>

test/pepper.qunit

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml" >
33
<head>
4-
<title>Sassij Engine Tests</title>
4+
<title>Sassijs Tests</title>
55
<script language="javascript" src="jquery-1.3.1.min.js" type="text/javascript"></script>
66
<script language="javascript" src="testrunner.js" type="text/javascript"></script>
77
<script language="javascript" src="testnavigation.js" type="text/javascript"></script>
@@ -37,10 +37,8 @@
3737

3838
</script>
3939

40-
<h1>Pepper Tests</h1>
41-
<h2 id="banner">
42-
<select id='test_select'></select>
43-
</h2>
40+
<h1></h1>
41+
<h2 id="banner"></h2>
4442
<ol id="tests"></ol>
4543
<div id="results"></div>
4644
<div id="main"></div>

test/sassijs.qunit

+1-46
Original file line numberDiff line numberDiff line change
@@ -29,56 +29,11 @@
2929
sassijs = new Sassijs( testTemplate() );
3030
equals( sassijs.getStyleElement(), '<style type="text/css"><!--\n' + testResult() + '\n--></style>' );
3131
});
32-
33-
34-
/*
35-
beforeEach = function(){
36-
testString = "this is a test string for the string scanner";
37-
stringScanner = new StringScanner( testString );
38-
}
39-
40-
test( "should be able to load an external file './temlates/basic.sass'", function(){
41-
sassijs = new SassijsFile( )beforeEach();
42-
equals( stringScanner.original, testString );
43-
});
44-
45-
test( "stringScanner.original should match a Regex", function(){
46-
beforeEach();
47-
equals( stringScanner.scan( /\w+/ ), "this" );
48-
});
49-
50-
test( "stringScanner.original should match a String", function(){
51-
beforeEach();
52-
equals( stringScanner.scan( 'this' ), "this" );
53-
});
54-
55-
test( "stringScanner.getCurrent should be the remainder after the match", function(){
56-
beforeEach();
57-
stringScanner.scan( 'test' );
58-
equals( stringScanner.getCurrent(), " string for the string scanner" );
59-
});
60-
61-
test( "stringScanner.original should match a String, then match the same String again, and then match a different String after the second one", function(){
62-
beforeEach();
63-
equals( stringScanner.scan( 'string' ), "string" );
64-
equals( stringScanner.scan( 'string' ), "string" );
65-
equals( stringScanner.scan( 'scanner' ), "scanner" );
66-
});
67-
68-
test( "stringScanner.original should match a String, then match the same String again, and then not find a different String occuring before the second one", function(){
69-
beforeEach();
70-
equals( stringScanner.scan( 'string' ), "string" );
71-
equals( stringScanner.scan( 'string' ), "string" );
72-
equals( stringScanner.scan( 'the' ), false );
73-
});
74-
*/
7532

7633
</script>
7734

7835
<h1></h1>
79-
<h2 id="banner">
80-
<select id='test_select'></select>
81-
</h2>
36+
<h2 id="banner"></h2>
8237
<ol id="tests"></ol>
8338
<div id="results"></div>
8439
<div id="main"></div>

test/sassijs/environment.qunit

-28
This file was deleted.

test/sassijs/error.qunit

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml" >
33
<head>
4-
<title>Sassij Engine Tests</title>
4+
<title>Sassijs Tests</title>
55
<script language="javascript" src="../jquery-1.3.1.min.js" type="text/javascript"></script>
66
<script language="javascript" src="../testrunner.js" type="text/javascript"></script>
77
<script language="javascript" src="../testnavigation.js" type="text/javascript"></script>
@@ -34,10 +34,8 @@
3434

3535
</script>
3636

37-
<h1>My Foo Tests</h1>
38-
<h2 id="banner">
39-
<select id='test_select'></select>
40-
</h2>
37+
<h1></h1>
38+
<h2 id="banner"></h2>
4139
<ol id="tests"></ol>
4240
<div id="results"></div>
4341
<div id="main"></div>

test/sassijs/expression.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
});
2121
</script>
2222
<h1></h1>
23-
<h2 id="banner">
24-
<select id='test_select'></select>
25-
</h2>
23+
<h2 id="banner"></h2>
2624
<ol id="tests"></ol>
2725
<div id="results"></div>
2826
<div id="main"></div>

test/sassijs/expression/unit.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232

3333
</script>
3434
<h1></h1>
35-
<h2 id="banner">
36-
<select id='test_select'></select>
37-
</h2>
35+
<h2 id="banner"></h2>
3836
<ol id="tests"></ol>
3937
<div id="results"></div>
4038
<div id="main"></div>

test/sassijs/file.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424

2525
</script>
2626
<h1></h1>
27-
<h2 id="banner">
28-
<select id='test_select'></select>
29-
</h2>
27+
<h2 id="banner"></h2>
3028
<ol id="tests"></ol>
3129
<div id="results"></div>
3230
<div id="main"></div>

test/sassijs/line.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@
6262

6363
</script>
6464
<h1></h1>
65-
<h2 id="banner">
66-
<select id='test_select'></select>
67-
</h2>
65+
<h2 id="banner"></h2>
6866
<ol id="tests"></ol>
6967
<div id="results"></div>
7068
<div id="main"></div>

test/sassijs/tree.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676

7777
</script>
7878
<h1></h1>
79-
<h2 id="banner">
80-
<select id='test_select'></select>
81-
</h2>
79+
<h2 id="banner"></h2>
8280
<ol id="tests"></ol>
8381
<div id="results"></div>
8482
<div id="main"></div>

test/sassijs/tree/attribute.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646

4747
</script>
4848
<h1></h1>
49-
<h2 id="banner">
50-
<select id='test_select'></select>
51-
</h2>
49+
<h2 id="banner"></h2>
5250
<ol id="tests"></ol>
5351
<div id="results"></div>
5452
<div id="main"></div>

test/sassijs/tree/comment.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222

2323
</script>
2424
<h1></h1>
25-
<h2 id="banner">
26-
<select id='test_select'></select>
27-
</h2>
25+
<h2 id="banner"></h2>
2826
<ol id="tests"></ol>
2927
<div id="results"></div>
3028
<div id="main"></div>

test/sassijs/tree/directive.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626

2727
</script>
2828
<h1></h1>
29-
<h2 id="banner">
30-
<select id='test_select'></select>
31-
</h2>
29+
<h2 id="banner"></h2>
3230
<ol id="tests"></ol>
3331
<div id="results"></div>
3432
<div id="main"></div>

test/sassijs/tree/mixin-definition.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636

3737
</script>
3838
<h1></h1>
39-
<h2 id="banner">
40-
<select id='test_select'></select>
41-
</h2>
39+
<h2 id="banner"></h2>
4240
<ol id="tests"></ol>
4341
<div id="results"></div>
4442
<div id="main"></div>

test/sassijs/tree/node.qunit

+2-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ SASS
114114

115115
</script>
116116

117-
<h1>Tree Node Tests</h1>
118-
<h2 id="banner">
119-
<select id='test_select'></select>
120-
</h2>
117+
<h1></h1>
118+
<h2 id="banner"></h2>
121119
<ol id="tests"></ol>
122120
<div id="results"></div>
123121
<div id="main"></div>

test/sassijs/tree/rule.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@
5454

5555
</script>
5656
<h1></h1>
57-
<h2 id="banner">
58-
<select id='test_select'></select>
59-
</h2>
57+
<h2 id="banner"></h2>
6058
<ol id="tests"></ol>
6159
<div id="results"></div>
6260
<div id="main"></div>

test/sassijs/tree/variable.qunit

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222

2323
</script>
2424
<h1></h1>
25-
<h2 id="banner">
26-
<select id='test_select'></select>
27-
</h2>
25+
<h2 id="banner"></h2>
2826
<ol id="tests"></ol>
2927
<div id="results"></div>
3028
<div id="main"></div>

0 commit comments

Comments
 (0)