@@ -4,14 +4,16 @@ describe('ClickCountView 모듈', () => {
4
4
beforeEach ( ( ) => {
5
5
updateEl = $ ( '<span></span>' ) ;
6
6
triggerEl = $ ( '<button></button>' ) ;
7
- clickCounter = ClickCounter ( ) ;
7
+ clickCounter = ClickCounter ( ) ; // todo: spy로 하자
8
8
view = ClickCountView ( clickCounter , { updateEl, triggerEl } )
9
9
} )
10
10
11
- it ( '클릭 이벤트가 발생하면 increseAndUpdateView를 실행한다' , ( ) => {
12
- spyOn ( view , 'increseAndUpdateView' )
13
- triggerEl . trigger ( 'click' )
14
- expect ( view . increseAndUpdateView ) . toHaveBeenCalled ( )
11
+ describe ( 'updateView()' , ( ) => {
12
+ it ( 'ClickCounter의 getCounter() 실행결과를 출력한다' , ( ) => {
13
+ const counterValue = clickCounter . getCounter ( ) . toString ( )
14
+ view . updateView ( )
15
+ expect ( updateEl . text ( ) ) . toBe ( counterValue )
16
+ } )
15
17
} )
16
18
17
19
describe ( 'increseAndUpdateView()' , ( ) => {
@@ -26,17 +28,11 @@ describe('ClickCountView 모듈', () => {
26
28
view . increseAndUpdateView ( )
27
29
expect ( view . updateView ) . toHaveBeenCalled ( )
28
30
} )
29
-
30
- it ( 'updateEl의 텍스트를 설정한다' , ( ) => {
31
- view . increseAndUpdateView ( )
32
- expect ( updateEl . text ( ) ) . toBe ( view . getClickCount ( ) . toString ( ) )
33
- } )
34
31
} )
35
32
36
- describe ( 'updateView()' , ( ) => {
37
- it ( '클릭한적이 없으면 "0"을 출력한다' , ( ) => {
38
- view . updateView ( )
39
- expect ( updateEl . text ( ) ) . toBe ( '0' )
40
- } )
33
+ it ( '클릭 이벤트가 발생하면 increseAndUpdateView를 실행한다' , ( ) => {
34
+ spyOn ( view , 'increseAndUpdateView' )
35
+ triggerEl . trigger ( 'click' )
36
+ expect ( view . increseAndUpdateView ) . toHaveBeenCalled ( )
41
37
} )
42
38
} )
0 commit comments