Commits
Yura Bondarenko authored 383485b16dd
39 39 | beforeEach(() => { |
40 40 | component.close(); |
41 41 | }); |
42 42 | it('should call the close method on the active modal', () => { |
43 43 | expect(modalStub.close).toHaveBeenCalled(); |
44 44 | }); |
45 45 | }); |
46 46 | |
47 47 | describe('confirmPressed', () => { |
48 48 | beforeEach(() => { |
49 - | spyOn(component.response, 'next'); |
49 + | spyOn(component.response, 'emit'); |
50 50 | component.confirmPressed(); |
51 51 | }); |
52 52 | it('should call the close method on the active modal', () => { |
53 53 | expect(modalStub.close).toHaveBeenCalled(); |
54 54 | }); |
55 - | it('behaviour subject should have true as next', () => { |
56 - | expect(component.response.next).toHaveBeenCalledWith(true); |
55 + | it('behaviour subject should emit true', () => { |
56 + | expect(component.response.emit).toHaveBeenCalledWith(true); |
57 57 | }); |
58 58 | }); |
59 59 | |
60 60 | describe('cancelPressed', () => { |
61 61 | beforeEach(() => { |
62 - | spyOn(component.response, 'next'); |
62 + | spyOn(component.response, 'emit'); |
63 63 | component.cancelPressed(); |
64 64 | }); |
65 65 | it('should call the close method on the active modal', () => { |
66 66 | expect(modalStub.close).toHaveBeenCalled(); |
67 67 | }); |
68 - | it('behaviour subject should have false as next', () => { |
69 - | expect(component.response.next).toHaveBeenCalledWith(false); |
68 + | it('behaviour subject should emit false', () => { |
69 + | expect(component.response.emit).toHaveBeenCalledWith(false); |
70 70 | }); |
71 71 | }); |
72 72 | |
73 73 | describe('when the click method emits on close button', () => { |
74 74 | beforeEach(fakeAsync(() => { |
75 75 | spyOn(component, 'close'); |
76 76 | debugElement.query(By.css('button.close')).triggerEventHandler('click', { |
77 77 | preventDefault: () => {/**/ |
78 78 | } |
79 79 | }); |
80 80 | tick(); |
81 81 | fixture.detectChanges(); |
82 82 | })); |
83 83 | it('should call the close method on the component', () => { |
84 84 | expect(component.close).toHaveBeenCalled(); |
85 85 | }); |
86 86 | }); |
87 87 | |
88 88 | describe('when the click method emits on cancel button', () => { |
89 89 | beforeEach(fakeAsync(() => { |
90 90 | spyOn(component, 'close'); |
91 - | spyOn(component.response, 'next'); |
91 + | spyOn(component.response, 'emit'); |
92 92 | debugElement.query(By.css('button.cancel')).triggerEventHandler('click', { |
93 93 | preventDefault: () => {/**/ |
94 94 | } |
95 95 | }); |
96 96 | tick(); |
97 97 | fixture.detectChanges(); |
98 98 | })); |
99 99 | it('should call the close method on the component', () => { |
100 100 | expect(component.close).toHaveBeenCalled(); |
101 101 | }); |
102 - | it('behaviour subject should have false as next', () => { |
103 - | expect(component.response.next).toHaveBeenCalledWith(false); |
102 + | it('behaviour subject should emit false', () => { |
103 + | expect(component.response.emit).toHaveBeenCalledWith(false); |
104 104 | }); |
105 105 | }); |
106 106 | |
107 107 | describe('when the click method emits on confirm button', () => { |
108 108 | beforeEach(fakeAsync(() => { |
109 109 | spyOn(component, 'close'); |
110 - | spyOn(component.response, 'next'); |
110 + | spyOn(component.response, 'emit'); |
111 111 | debugElement.query(By.css('button.confirm')).triggerEventHandler('click', { |
112 112 | preventDefault: () => {/**/ |
113 113 | } |
114 114 | }); |
115 115 | tick(); |
116 116 | fixture.detectChanges(); |
117 117 | })); |
118 118 | it('should call the close method on the component', () => { |
119 119 | expect(component.close).toHaveBeenCalled(); |
120 120 | }); |
121 - | it('behaviour subject should have true as next', () => { |
122 - | expect(component.response.next).toHaveBeenCalledWith(true); |
121 + | it('behaviour subject should emit false', () => { |
122 + | expect(component.response.emit).toHaveBeenCalledWith(true); |
123 123 | }); |
124 124 | }); |
125 125 | |
126 126 | }); |