@@ -10,7 +10,7 @@ dummyFetch = ->
10
10
test (' populateCollections populates indicators from the server' , (done )->
11
11
server = sinon .fakeServer .create ()
12
12
13
- indicators = [title : ' hat' ]
13
+ indicators = [name : ' hat' ]
14
14
15
15
indicatorSelector =
16
16
indicators : new Backbone.Collections.IndicatorCollection ([], withData : true )
@@ -20,7 +20,7 @@ test('populateCollections populates indicators from the server', (done)->
20
20
Helpers .Assertions .assertPathVisited (server, new RegExp (" /api/indicators" ))
21
21
22
22
assert .strictEqual (
23
- indicatorSelector .indicators .at (0 ).get (' title ' ), indicators[0 ].title
23
+ indicatorSelector .indicators .at (0 ).get (' name ' ), indicators[0 ].name
24
24
)
25
25
26
26
done ()
@@ -46,8 +46,8 @@ test('.initialize populates the indicators collection,
46
46
_id : Factory .findNextFreeId (' Section' )
47
47
)
48
48
49
- indicatorTitle = ' An indicator'
50
- indicators = [{_id : 1 , title : indicatorTitle }]
49
+ indicatorName = ' An indicator'
50
+ indicators = [{_id : 1 , name : indicatorName }]
51
51
52
52
@ stub (Backbone .Collections .IndicatorCollection :: , ' fetch' , ->
53
53
Helpers .promisify (=>
@@ -86,7 +86,7 @@ test('Renders a ThemeFilters sub view with the collection of indicators', sinon.
86
86
_id : Factory .findNextFreeId (' Section' )
87
87
)
88
88
89
- indicators = [{_id : 1 , title : " Such Theme " }]
89
+ indicators = [{_id : 1 , name : " Such Indicator " }]
90
90
91
91
@ stub (Backbone .Collections .IndicatorCollection :: , ' fetch' , ->
92
92
Helpers .promisify (=>
@@ -154,10 +154,10 @@ test("When 'indicator_selector:theme_selected' is triggered,
154
154
155
155
test (' When `indicator_selector:indicator_selected` event is fired on backbone
156
156
it triggers the `indicatorSelected` event on itself' , (done )->
157
- indicatorText = ' hats'
157
+ indicatorName = ' hats'
158
158
indicatorAttributes = [{
159
159
type : ' cartodb'
160
- title : indicatorText
160
+ name : indicatorName
161
161
}]
162
162
163
163
sandbox = sinon .sandbox .create ()
@@ -177,7 +177,7 @@ test('When `indicator_selector:indicator_selected` event is fired on backbone
177
177
178
178
indicatorSelectedCallback = (indicator ) ->
179
179
try
180
- assert .strictEqual indicator .get (' title ' ), indicatorText
180
+ assert .strictEqual indicator .get (' name ' ), indicatorName
181
181
done ()
182
182
catch err
183
183
done (err)
@@ -223,8 +223,8 @@ test(".filterByTheme given a theme sets the results object to only
223
223
assert .isTrue collectionFilterByThemeStub .calledWith (filterTheme)
224
224
)
225
225
226
- test (" .filterByTitle given an input event sets the results object to only
227
- indicators with a matching title " , ->
226
+ test (" .filterByName given an input event sets the results object to only
227
+ indicators with a matching name " , ->
228
228
view =
229
229
indicators : new Backbone.Collections.IndicatorCollection ([])
230
230
results : new Backbone.Collections.IndicatorCollection ()
@@ -234,30 +234,30 @@ test(".filterByTitle given an input event sets the results object to only
234
234
235
235
event = target : ' <input value="hats and boats and cats">'
236
236
237
- filterTitleIndicator = Factory .indicator ()
238
- collectionFilterByTitleStub = sinon .stub (
239
- Backbone .Collections .IndicatorCollection :: , ' filterByTitle ' , ->
240
- return [filterTitleIndicator ]
237
+ filterNameIndicator = Factory .indicator ()
238
+ collectionfilterByNameStub = sinon .stub (
239
+ Backbone .Collections .IndicatorCollection :: , ' filterByName ' , ->
240
+ return [filterNameIndicator ]
241
241
)
242
242
243
- Backbone .Views .IndicatorSelectorView :: filterByTitle .call (
243
+ Backbone .Views .IndicatorSelectorView :: filterByName .call (
244
244
view, event
245
245
)
246
246
247
247
try
248
248
assert .ok (
249
- collectionFilterByTitleStub .calledOnce ,
250
- " Expected filterByTitle to be called once but was called
251
- #{ collectionFilterByTitleStub .callCount } times"
249
+ collectionfilterByNameStub .calledOnce ,
250
+ " Expected filterByName to be called once but was called
251
+ #{ collectionfilterByNameStub .callCount } times"
252
252
)
253
253
254
254
assert .lengthOf view .results .models , 1 ,
255
255
" Expected the collection to be filtered to only the correct indicator"
256
256
257
- assert .deepEqual view .results .at (0 ), filterTitleIndicator ,
257
+ assert .deepEqual view .results .at (0 ), filterNameIndicator ,
258
258
" Expected the result indicator to be the correct one for the given theme"
259
259
finally
260
- collectionFilterByTitleStub .restore ()
260
+ collectionfilterByNameStub .restore ()
261
261
)
262
262
263
263
test (' .filterBySource sets a sourceName attribute on the @filter' , ->
@@ -276,7 +276,7 @@ test('.filterBySource sets a sourceName attribute on the @filter', ->
276
276
" Expected filterIndicators to be called with the new filters"
277
277
)
278
278
279
- test (" When the data origin sub view triggers 'selected',
279
+ test (" When the data origin sub view triggers 'selected',
280
280
filterBySource is triggered" , sinon .test (->
281
281
282
282
section = new Backbone.Models.Section (
@@ -345,22 +345,22 @@ sinon.test(->
345
345
346
346
theme = Factory .theme ()
347
347
matchingIndicator = Factory .indicator (
348
- title : " Matching title , theme and type"
348
+ name : " Matching name , theme and type"
349
349
theme : theme .get (' _id' )
350
350
source : name : ' cygnet'
351
351
)
352
352
353
353
indicators = [
354
354
matchingIndicator
355
355
{
356
- title : " Matching title and theme only" , theme : theme .get (' _id' )}
356
+ name : " Matching name and theme only" , theme : theme .get (' _id' )}
357
357
{
358
- title : " Matches theme and source only" ,
358
+ name : " Matches theme and source only" ,
359
359
theme : theme .get (' _id' ),
360
360
source : name : ' cygnet'
361
361
},
362
362
{
363
- title : " Matching title and source only" ,
363
+ name : " Matching name and source only" ,
364
364
theme : Factory .findNextFreeId (' Theme' ),
365
365
source : name : ' cygnet'
366
366
}
@@ -378,7 +378,7 @@ sinon.test(->
378
378
)
379
379
380
380
view .filterByTheme (theme)
381
- view .filterByTitle ({target : ' <input value="Matching">' })
381
+ view .filterByName ({target : ' <input value="Matching">' })
382
382
view .filterBySource (' cygnet' )
383
383
384
384
try
0 commit comments