Skip to content

Commit 4627c57

Browse files
frinyvonnickeddyerburgh
authored andcommitted
[Fix] Hide colon when seconds are hidden (#6)
1 parent 14f2ef0 commit 4627c57

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Clock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
--><span v-if="!blink || seconds % 2 === 0">:</span><!--
55
--><span v-else>&nbsp;</span><!--
66
--><span class="clock__minutes">{{ minutes }}</span><!--
7-
--><span v-if="!blink || (seconds % 2 === 0 && displaySeconds)">:</span><!--
7+
--><span v-if="displaySeconds && (!blink || seconds % 2 === 0)">:</span><!--
88
--><span v-else-if="displaySeconds">&nbsp;</span><!--
99
--><span v-if="displaySeconds" class="clock__seconds">{{ seconds }}</span>
1010
</time>

test/unit/specs/Clock.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('Clock.vue', () => {
134134
const wrapper = mount(Clock, { propsData: { blink: true } });
135135
expect(wrapper.text()).to.not.contain(':');
136136
});
137-
137+
138138
it('Calls clear input with vm.ticker when component is destroyed', () => {
139139
const stub = sinon.stub();
140140
window.clearInterval = stub;
@@ -143,4 +143,9 @@ describe('Clock.vue', () => {
143143
wrapper.destroy();
144144
expect(stub.args[0][0]).to.equal(ticker);
145145
});
146+
147+
it('should not display second colon by default', () => {
148+
const wrapper = mount(Clock);
149+
expect((wrapper.text().match(/:/g) || []).length).to.equal(1);
150+
});
146151
});

0 commit comments

Comments
 (0)