Skip to content

Commit 0d0ece8

Browse files
committed
initial commit
0 parents  commit 0d0ece8

File tree

10 files changed

+4857
-0
lines changed

10 files changed

+4857
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Unit Tests for - the words utility</title>
5+
<link rel="stylesheet" type="text/css" href="../qunit/qunit.css">
6+
<script src="../qunit/qunit.js"></script>
7+
<script src="../qunit/qunit-reporter-junit.js"></script>
8+
<script src="words-utility.js"></script>
9+
<script src="words-utility-tests.js"></script>
10+
</head>
11+
<body>
12+
<div id="qunit">
13+
14+
</div>
15+
<div id="qunit-fixture">
16+
17+
</div>
18+
</body>
19+
</html>

ExerciseOne/words-utility-tests.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
QUnit.test( "test if words are counted correctly", function( assert ) {
2+
var wordsUtility = new WordsUtility("ola yeah yoyo");
3+
assert.equal(wordsUtility.countWords(), 3);
4+
});
5+
6+
QUnit.test( "find the longest word", function( assert ) {
7+
var wordsUtility = new WordsUtility("ola yeah yoyoyo yoda");
8+
assert.equal(wordsUtility.longestWord(), "yoyoyo");
9+
});
10+
11+
QUnit.test( "the average word length of words supplied", function( assert ) {
12+
var wordsUtility = new WordsUtility("ola yeah yoyoyo");
13+
assert.equal(wordsUtility.averageWordLength(), "ola");
14+
});
15+
16+
QUnit.test( "find words with the same length", function( assert ) {
17+
18+
var wordsUtility = new WordsUtility("ola yeah yoyoyo yoda");
19+
var words = wordsUtility.wordsWithTheSameLength();
20+
});
21+
22+
23+
QUnit.test( "no words with the same length return nothing", function( assert ) {
24+
var wordsUtility = new WordsUtility("ola yeah yoyoyo yoda");
25+
26+
assert.equal(0, wordsUtility.wordsWithTheSameLength().length);
27+
28+
});
29+
30+
QUnit.test( "find the shortest word", function( assert ) {
31+
var wordsUtility = new WordsUtility("ola yeah yoyoyo");
32+
assert.equal(wordsUtility.shortestWord(), "ola");
33+
});
34+
35+
QUnit.jUnitReport = function(report) {
36+
console.log(report.xml);
37+
};
38+
39+
//create a test for What letter does the most words start with
40+
41+
//create a test for What letter does the most words end with
42+

ExerciseOne/words-utility.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
WordsUtility = function(words){
3+
4+
this.countWords = function(){
5+
return words.split(" ").length;
6+
}
7+
}

gulpfile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var gulp = require('gulp'),
2+
qunit = require('gulp-qunit');
3+
4+
gulp.task('test', function() {
5+
return gulp.src('./ExerciseOne/test-words-utility.html')
6+
.pipe(qunit());
7+
});

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "codeX_Programming101",
3+
"version": "0.0.0",
4+
"description": "",
5+
"main": "gulpfile.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"devDependencies": {
12+
"gulp-qunit": "^0.3.3"
13+
}
14+
}

qunit/qunit-reporter-junit.js

Lines changed: 2035 additions & 0 deletions
Large diffs are not rendered by default.

qunit/qunit.css

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
/*!
2+
* QUnit 1.15.0
3+
* http://qunitjs.com/
4+
*
5+
* Copyright 2014 jQuery Foundation and other contributors
6+
* Released under the MIT license
7+
* http://jquery.org/license
8+
*
9+
* Date: 2014-08-08T16:00Z
10+
*/
11+
12+
/** Font Family and Sizes */
13+
14+
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
15+
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
16+
}
17+
18+
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
19+
#qunit-tests { font-size: smaller; }
20+
21+
22+
/** Resets */
23+
24+
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
25+
margin: 0;
26+
padding: 0;
27+
}
28+
29+
30+
/** Header */
31+
32+
#qunit-header {
33+
padding: 0.5em 0 0.5em 1em;
34+
35+
color: #8699A4;
36+
background-color: #0D3349;
37+
38+
font-size: 1.5em;
39+
line-height: 1em;
40+
font-weight: 400;
41+
42+
border-radius: 5px 5px 0 0;
43+
}
44+
45+
#qunit-header a {
46+
text-decoration: none;
47+
color: #C2CCD1;
48+
}
49+
50+
#qunit-header a:hover,
51+
#qunit-header a:focus {
52+
color: #FFF;
53+
}
54+
55+
#qunit-testrunner-toolbar label {
56+
display: inline-block;
57+
padding: 0 0.5em 0 0.1em;
58+
}
59+
60+
#qunit-banner {
61+
height: 5px;
62+
}
63+
64+
#qunit-testrunner-toolbar {
65+
padding: 0.5em 1em 0.5em 1em;
66+
color: #5E740B;
67+
background-color: #EEE;
68+
overflow: hidden;
69+
}
70+
71+
#qunit-userAgent {
72+
padding: 0.5em 1em 0.5em 1em;
73+
background-color: #2B81AF;
74+
color: #FFF;
75+
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
76+
}
77+
78+
#qunit-modulefilter-container {
79+
float: right;
80+
}
81+
82+
/** Tests: Pass/Fail */
83+
84+
#qunit-tests {
85+
list-style-position: inside;
86+
}
87+
88+
#qunit-tests li {
89+
padding: 0.4em 1em 0.4em 1em;
90+
border-bottom: 1px solid #FFF;
91+
list-style-position: inside;
92+
}
93+
94+
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
95+
display: none;
96+
}
97+
98+
#qunit-tests li strong {
99+
cursor: pointer;
100+
}
101+
102+
#qunit-tests li a {
103+
padding: 0.5em;
104+
color: #C2CCD1;
105+
text-decoration: none;
106+
}
107+
#qunit-tests li a:hover,
108+
#qunit-tests li a:focus {
109+
color: #000;
110+
}
111+
112+
#qunit-tests li .runtime {
113+
float: right;
114+
font-size: smaller;
115+
}
116+
117+
.qunit-assert-list {
118+
margin-top: 0.5em;
119+
padding: 0.5em;
120+
121+
background-color: #FFF;
122+
123+
border-radius: 5px;
124+
}
125+
126+
.qunit-collapsed {
127+
display: none;
128+
}
129+
130+
#qunit-tests table {
131+
border-collapse: collapse;
132+
margin-top: 0.2em;
133+
}
134+
135+
#qunit-tests th {
136+
text-align: right;
137+
vertical-align: top;
138+
padding: 0 0.5em 0 0;
139+
}
140+
141+
#qunit-tests td {
142+
vertical-align: top;
143+
}
144+
145+
#qunit-tests pre {
146+
margin: 0;
147+
white-space: pre-wrap;
148+
word-wrap: break-word;
149+
}
150+
151+
#qunit-tests del {
152+
background-color: #E0F2BE;
153+
color: #374E0C;
154+
text-decoration: none;
155+
}
156+
157+
#qunit-tests ins {
158+
background-color: #FFCACA;
159+
color: #500;
160+
text-decoration: none;
161+
}
162+
163+
/*** Test Counts */
164+
165+
#qunit-tests b.counts { color: #000; }
166+
#qunit-tests b.passed { color: #5E740B; }
167+
#qunit-tests b.failed { color: #710909; }
168+
169+
#qunit-tests li li {
170+
padding: 5px;
171+
background-color: #FFF;
172+
border-bottom: none;
173+
list-style-position: inside;
174+
}
175+
176+
/*** Passing Styles */
177+
178+
#qunit-tests li li.pass {
179+
color: #3C510C;
180+
background-color: #FFF;
181+
border-left: 10px solid #C6E746;
182+
}
183+
184+
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
185+
#qunit-tests .pass .test-name { color: #366097; }
186+
187+
#qunit-tests .pass .test-actual,
188+
#qunit-tests .pass .test-expected { color: #999; }
189+
190+
#qunit-banner.qunit-pass { background-color: #C6E746; }
191+
192+
/*** Failing Styles */
193+
194+
#qunit-tests li li.fail {
195+
color: #710909;
196+
background-color: #FFF;
197+
border-left: 10px solid #EE5757;
198+
white-space: pre;
199+
}
200+
201+
#qunit-tests > li:last-child {
202+
border-radius: 0 0 5px 5px;
203+
}
204+
205+
#qunit-tests .fail { color: #000; background-color: #EE5757; }
206+
#qunit-tests .fail .test-name,
207+
#qunit-tests .fail .module-name { color: #000; }
208+
209+
#qunit-tests .fail .test-actual { color: #EE5757; }
210+
#qunit-tests .fail .test-expected { color: #008000; }
211+
212+
#qunit-banner.qunit-fail { background-color: #EE5757; }
213+
214+
215+
/** Result */
216+
217+
#qunit-testresult {
218+
padding: 0.5em 1em 0.5em 1em;
219+
220+
color: #2B81AF;
221+
background-color: #D2E0E6;
222+
223+
border-bottom: 1px solid #FFF;
224+
}
225+
#qunit-testresult .module-name {
226+
font-weight: 700;
227+
}
228+
229+
/** Fixture */
230+
231+
#qunit-fixture {
232+
position: absolute;
233+
top: -10000px;
234+
left: -10000px;
235+
width: 1000px;
236+
height: 1000px;
237+
}

0 commit comments

Comments
 (0)