diff options
| author | mo khan <mo@mokhan.ca> | 2015-06-22 19:26:21 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-06-22 19:26:21 -0600 |
| commit | 340c9f0893f73d7540eaa9efa5b741b0ee272f6b (patch) | |
| tree | 0a30d14cb04256ae93d3caf513884791449d7a00 /spec/javascripts | |
| parent | 9f6460898f0d4a4d5f763f32d2e6943316bb6145 (diff) | |
add specs for the google button view.
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/views/google_sync_button_spec.js.coffee | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/spec/javascripts/views/google_sync_button_spec.js.coffee b/spec/javascripts/views/google_sync_button_spec.js.coffee index 6862465..d12b0df 100644 --- a/spec/javascripts/views/google_sync_button_spec.js.coffee +++ b/spec/javascripts/views/google_sync_button_spec.js.coffee @@ -3,10 +3,25 @@ describe "GoogleSyncButton", -> beforeEach -> @subject = new Stronglifters.GoogleSyncButton() + it 'displays the correct button text', -> + expect(@subject.get('text')).toEqual("Sync with Google") + describe "synchronize", -> + beforeEach -> + @drive = { syncFile: null } + spyOn(@drive, 'syncFile') + spyOn(@subject, 'drive').and.returnValue(@drive) + it 'synchronizes the drive', -> - drive = { syncFile: null } - spyOn(drive, 'syncFile') - @subject.synchronize(drive) - expect(drive).to haveCalled('syncFile') + @subject.synchronize(@drive) + expect(@drive.syncFile).toHaveBeenCalled() + + it 'changes the text on the button', -> + @subject.synchronize(@drive) + expect(@subject.get('text')).toEqual('Syncing...') + + it 'changes the button icon', -> + @subject.synchronize(@drive) + expect(@subject.get('icon')).toContain('fa-spin') + expect(@subject.get('icon')).toContain('fa-spinner') |
