Skip to content

Commit b6906e8

Browse files
committed
Factored out logo block
1 parent 267ce59 commit b6906e8

4 files changed

Lines changed: 61 additions & 12 deletions

File tree

src/client/_css_test.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
var assert = require("../shared/_assert.js");
88
var quixote = require("./vendor/quixote-0.7.1.js");
99

10+
var TRANSPARENT = "rgba(0, 0, 0, 0)";
1011
var WHITE = "rgb(255, 255, 255)";
1112
var DARK_GRAY = "rgb(89, 89, 89)";
1213
var GRAY = "rgb(229, 229, 229)";
@@ -82,7 +83,7 @@
8283

8384
it("has no padding or margins", function() {
8485
assert.equal(margin(buttonTag), "0px", "margin");
85-
assert.equal(padding (buttonTag), "0px", "margin");
86+
assert.equal(padding(buttonTag), "0px", "padding");
8687
});
8788

8889
it("has rounded corners", function() {
@@ -125,7 +126,6 @@
125126
assertHoverStyle(linkTag, DARKENED_MEDIUM_BLUE, "hover background");
126127
});
127128

128-
129129
});
130130

131131

@@ -162,6 +162,42 @@
162162
});
163163

164164

165+
describe("Logo", function() {
166+
167+
var logo;
168+
169+
beforeEach(function() {
170+
logo = frame.add("<div class='logo'>logo</a>", "logo");
171+
});
172+
173+
it("fills its container", function() {
174+
logo.assert({
175+
width: frame.body().width
176+
});
177+
});
178+
179+
it("is nice and big", function() {
180+
logo.assert({
181+
height: 30
182+
});
183+
});
184+
185+
it("text", function() {
186+
assert.equal(textAlign(logo), "center", "should be horizontally centered");
187+
assert.equal(isTextVerticallyCentered(logo), true, "should be vertically centered");
188+
assert.equal(fontSize(logo), "30px", "font size");
189+
assert.equal(fontWeight(logo), HEADLINE_WEIGHT, "font weight");
190+
});
191+
192+
it("color", function() {
193+
assert.equal(backgroundColor(logo), TRANSPARENT, "background color");
194+
assert.equal(textColor(logo), WHITE, "text color");
195+
});
196+
197+
});
198+
199+
200+
165201

166202
describe("Drawing area", function() {
167203

@@ -822,6 +858,7 @@
822858

823859
function normalizeColorString(color) {
824860
if (color === "white") return "rgb(255, 255, 255)";
861+
if (color === "transparent") return "rgba(0, 0, 0, 0)";
825862

826863
var colorGroups = color.match(/^#(..)(..)(..)/); // look for presence of #rrggbb string
827864
if (colorGroups === null) return color; // if doesn't match, assume we have rgb() string

src/client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</head>
6666
<body>
6767

68-
<div id="logo">
68+
<div id="logo" class="logo">
6969
<img src="/images/weewiki-logo.png" width="181" height="25" alt="WeeWikiPaint">
7070
</div>
7171

src/client/screen.css

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,30 @@ body {
115115
}
116116

117117

118+
/* Logo block */
119+
120+
.logo {
121+
/* size */
122+
height: 30px;
123+
124+
/* text */
125+
text-align: center;
126+
line-height: 30px; /* vertical centering */
127+
font-size: 30px;
128+
font-weight: 600;
129+
130+
/* color */
131+
color: white;
132+
}
133+
134+
118135
/* Home page */
119136

120137
#logo {
121-
line-height: 1;
122-
height: 30px;
123138
margin-top: 12px;
124139
margin-left: auto;
125140
margin-right: auto;
126141
margin-bottom: 0px;
127-
text-align: center;
128-
font-size: 30px;
129-
font-weight: 600;
130-
color: white;
131142
}
132143

133144
#tagline {

todo.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ Engineering Tasks:
3232

3333
To Do on current task:
3434
* factor out blocks (with TDD)
35-
* factor out header
36-
- factor out subheader
37-
- factor out tagline
35+
* factor out logo
3836
- factor out 404 headline
3937
- factor out theme
38+
- factor out subheader
39+
- factor out tagline
4040
- factor out layout (with TDD?)
41+
- should each block have a 'fill its container' test?
4142
- Improve our client directory structure
4243
- Split our CSS tests into multiple files

0 commit comments

Comments
 (0)