Skip to content

Commit 40625e4

Browse files
committed
[MINIFY]: test for css and html added
Signed-off-by: ashish <[email protected]>
1 parent 8d73da5 commit 40625e4

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

test/commands/minify.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,18 @@ describe('minify', () => {
3232
expect(ctx.stdout).to.contain('console.log("lorem ipsum");let x=10;x<10?console.log("x is less than: "+x):x>10?console.log("x is more than: "+x):console.log("x is equals to: "+x);')
3333
})
3434

35+
test
36+
.stdout()
37+
.command(['minify', '-f', 'test/resources/test.html'])
38+
.it('Minify HTML', ctx => {
39+
expect(ctx.stdout).to.contain('<title>TEST</title><h1>heading</h1><p>lorem ipsum 1<p>lorem ipsum 2<p>lorem ipsum 3')
40+
})
41+
42+
test
43+
.stdout()
44+
.command(['minify', '-f', 'test/resources/test.css'])
45+
.it('Minify CSS', ctx => {
46+
expect(ctx.stdout).to.contain('body{margin:25px;background-color:#f0f0f0;font-family:arial,sans-serif;font-size:14px}h1{font-size:35px;font-weight:400;margin-top:5px}.someclass{color:red}#someid{color:green}')
47+
})
48+
3549
})

test/resources/test.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* Applies to the entire body of the HTML document (except where overridden by more specific
2+
selectors). */
3+
body {
4+
margin: 25px;
5+
background-color: rgb(240, 240, 240);
6+
font-family: arial, sans-serif;
7+
font-size: 14px;
8+
}
9+
/* Applies to all <h1>...</h1> elements. */
10+
h1 {
11+
font-size: 35px;
12+
font-weight: normal;
13+
margin-top: 5px;
14+
}
15+
/* Applies to all elements with <... class="someclass"> specified. */
16+
.someclass {
17+
color: red;
18+
}
19+
/* Applies to the element with <... id="someid"> specified. */
20+
#someid {
21+
color: green;
22+
}

test/resources/test.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
</head>
55
<body>
66
<h1>heading</h1>
7-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci aperiam, at cupiditate delectus deleniti fugiat, harum ipsa labore laboriosam magni nulla obcaecati quae repellendus. Distinctio eum impedit iure laborum voluptatem?</p>
7+
<p>lorem ipsum 1</p>
8+
<p>lorem ipsum 2</p>
9+
<p>lorem ipsum 3</p>
810
</body>
911
</html>

test/resources/test2.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body{margin:25px;background-color:#f0f0f0;font-family:arial,sans-serif;font-size:14px}h1{font-size:35px;font-weight:400;margin-top:5px}.someclass{color:red}#someid{color:green}

0 commit comments

Comments
 (0)