diff --git a/Gruntfile.js b/Gruntfile.js index 7ab607d..c5c98c5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -49,6 +49,7 @@ module.exports = function(grunt) { // helper 'js/helpers/formatter.js', 'js/helpers/util.js', + 'js/helpers/ajax.js', 'js/helpers/handlebarsHelper.js', 'js/helpers/dataTablesRenderer.js', @@ -318,16 +319,14 @@ module.exports = function(grunt) { dest : '<%= globe.test %>karma.conf.js' }, app: { - src: '<%= globe.src %>js/application/intro.js', - dest: '<%= globe.tmp %>js/application/intro.js' + files: { + '<%= globe.tmp %>js/application/intro.js': '<%= globe.src %>js/application/intro.js', + '<%= globe.tmp %>js/helpers/ajax.js': '<%= globe.src %>js/helpers/ajax.js' + } } }, env: { - options : { - /* Shared Options Hash */ - //globalOption : 'foo' - }, dev: { NODE_ENV : 'DEVELOPMENT' }, diff --git a/src/js/application/intro.js b/src/js/application/intro.js index 882b2a0..8a9161b 100644 --- a/src/js/application/intro.js +++ b/src/js/application/intro.js @@ -1,4 +1,4 @@ -/*global $, prepareForTesting, Ember, jQuery, InstallTrigger */ +/*global $, prepareForTesting, Ember, Em, jQuery, InstallTrigger */ 'use strict'; // create ember application and set namespace @@ -13,6 +13,9 @@ if($.isFunction(window.prepareForTesting)){ // create Ember application with some extra methods GLOBE = GLOBE.reopen({ + // api baseurl + api: 'https://onionoo.torproject.org', + // model defaults defaults: [], @@ -23,7 +26,7 @@ GLOBE = GLOBE.reopen({ loading: 0, // application alert - alert: Ember.Object.create({ + alert: Em.Object.create({ search: null }), @@ -49,7 +52,7 @@ GLOBE = GLOBE.reopen({ */ setAlert: function(location, type, msg){ if(this.get('alert').hasOwnProperty(location)){ - this.set('alert.' + location, Ember.Object.create({ + this.set('alert.' + location, Em.Object.create({ type: type, msg: msg })); @@ -463,6 +466,6 @@ jQuery.fn.dataTableExt.oSort['port-asc'] = function(x,y) { return xInt > yInt ? 1 : xInt < yInt ? -1 : 0; }; -GLOBE.TextField = Ember.TextField.extend({ +GLOBE.TextField = Em.TextField.extend({ attributeBindings: ['accept', 'autocomplete', 'autofocus', 'name', 'required'] }); \ No newline at end of file diff --git a/src/js/components/AlertBoxComponent.js b/src/js/components/AlertBoxComponent.js index cc43e38..69cc99b 100644 --- a/src/js/components/AlertBoxComponent.js +++ b/src/js/components/AlertBoxComponent.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.AlertBoxComponent = Ember.Component.extend({ +/*global GLOBE, Em */ +GLOBE.AlertBoxComponent = Em.Component.extend({ tagName: 'div', baseClass: 'alert', diff --git a/src/js/components/LoadingIndicatorComponent.js b/src/js/components/LoadingIndicatorComponent.js index 490f39f..0ef7746 100644 --- a/src/js/components/LoadingIndicatorComponent.js +++ b/src/js/components/LoadingIndicatorComponent.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.LoadingIndicatorComponent = Ember.Component.extend({ +/*global GLOBE, Em */ +GLOBE.LoadingIndicatorComponent = Em.Component.extend({ isDataLoaded: function(){ // change isDataLoaded depending on GLOBE.loading number diff --git a/src/js/controllers/ApplicationController.js b/src/js/controllers/ApplicationController.js index 5356402..523a047 100644 --- a/src/js/controllers/ApplicationController.js +++ b/src/js/controllers/ApplicationController.js @@ -1,5 +1,5 @@ -/*global $, GLOBE, Ember */ -GLOBE.ApplicationController = Ember.Controller.extend({ +/*global $, GLOBE, Em */ +GLOBE.ApplicationController = Em.Controller.extend({ needs: ['relaySearch'], value: '', query: '', diff --git a/src/js/controllers/BridgeDetailController.js b/src/js/controllers/BridgeDetailController.js index e0872c0..fbc97cd 100644 --- a/src/js/controllers/BridgeDetailController.js +++ b/src/js/controllers/BridgeDetailController.js @@ -1,5 +1,5 @@ -/*global $, GLOBE, Ember */ -GLOBE.BridgeDetailController = Ember.ObjectController.extend({ +/*global $, GLOBE, Em */ +GLOBE.BridgeDetailController = Em.ObjectController.extend({ bandwidthData: {}, weightData: {}, content: {}, diff --git a/src/js/controllers/RelayDetailController.js b/src/js/controllers/RelayDetailController.js index ab1a603..3997f5b 100644 --- a/src/js/controllers/RelayDetailController.js +++ b/src/js/controllers/RelayDetailController.js @@ -1,5 +1,5 @@ -/*global $, GLOBE, Ember */ -GLOBE.RelayDetailController = Ember.ObjectController.extend({ +/*global $, GLOBE, Em */ +GLOBE.RelayDetailController = Em.ObjectController.extend({ bandwidthData: {}, weightData: {}, content: {}, diff --git a/src/js/controllers/SummarySearchController.js b/src/js/controllers/SummarySearchController.js index 41dfbb9..4744ca9 100644 --- a/src/js/controllers/SummarySearchController.js +++ b/src/js/controllers/SummarySearchController.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.SummarySearchController = Ember.ArrayController.extend({ +/*global GLOBE, Em */ +GLOBE.SummarySearchController = Em.ArrayController.extend({ needs: 'application', content: [], active: 'relays', @@ -9,13 +9,13 @@ GLOBE.SummarySearchController = Ember.ArrayController.extend({ query: '', summaries: {}, - relays: Ember.ArrayController.create({ - content: Ember.A([]), - summaries: Ember.A([]) + relays: Em.ArrayController.create({ + content: Em.A([]), + summaries: Em.A([]) }), - bridges: Ember.ArrayController.create({ - content: Ember.A([]), - summaries: Ember.A([]) + bridges: Em.ArrayController.create({ + content: Em.A([]), + summaries: Em.A([]) }), relaysActive: function () { diff --git a/src/js/controllers/Top10Controller.js b/src/js/controllers/Top10Controller.js index 785b60d..1d8091b 100644 --- a/src/js/controllers/Top10Controller.js +++ b/src/js/controllers/Top10Controller.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.Top10Controller = Ember.ArrayController.extend({ +/*global GLOBE, Em */ +GLOBE.Top10Controller = Em.ArrayController.extend({ needs: ['application'], content: [], relays: [], diff --git a/src/js/helpers/ajax.js b/src/js/helpers/ajax.js new file mode 100644 index 0000000..8021f85 --- /dev/null +++ b/src/js/helpers/ajax.js @@ -0,0 +1,52 @@ +/*global GLOBE, Em */ + +/** + * $.ajax wrapper that uses Ember.run to run async code. + * Necessary for async Ember testing. + * Inspired by discourse ajax wrapper. + * + * @see {@link https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/mixins/ajax.js} + * @param {Object} settings + * @returns {Promise} + */ +GLOBE.ajax = function (settings) { + return new Em.RSVP.Promise(function(resolve, reject) { + + // @if NODE_ENV == 'TESTING' + // only available for testing + var fixture = GLOBE.TESTING_FIXTURES && GLOBE.TESTING_FIXTURES[settings.url]; + if (fixture) { + Em.run(null, resolve, fixture); + } else { + // @endif + + // prefix url + settings.url = GLOBE.get('api') + settings.url; + + settings.success = function(response) { + Em.run(null, resolve, response); + }; + settings.error = function(jqXHR, textStatus) { + Em.run(null, reject, textStatus); + }; + Em.$.ajax(settings); + + // @if NODE_ENV == 'TESTING' + } + // @endif + }); +}; +/** + * Calls GLOBE.ajax with parameters to imitate $.getJSON + * @see {@link GLOBE.ajax} + * @param {String} url + * @param {Object} [data] + * @returns {Promise} + */ +GLOBE.getJSON = function (url, data) { + return GLOBE.ajax({ + dataType: 'json', + data: data || {}, + url: url + }); +}; \ No newline at end of file diff --git a/src/js/helpers/dataTablesRenderer.js b/src/js/helpers/dataTablesRenderer.js index 667acfc..dcfa77f 100644 --- a/src/js/helpers/dataTablesRenderer.js +++ b/src/js/helpers/dataTablesRenderer.js @@ -67,11 +67,10 @@ GLOBE.DataTableRenderer = { * @returns {String} extracted port */ firstPort: function (data, type) { - data = data[0]; if (type === 'display') { - return GLOBE.Formatter.extractPort(data); + return GLOBE.Formatter.extractPort(data[0]); } - return data; + return data[0]; }, /** * @see {@link GLOBE.Formatter.extractPort} diff --git a/src/js/helpers/handlebarsHelper.js b/src/js/helpers/handlebarsHelper.js index c9adbd9..50056b8 100644 --- a/src/js/helpers/handlebarsHelper.js +++ b/src/js/helpers/handlebarsHelper.js @@ -1,8 +1,8 @@ -/*global GLOBE, Handlebars, Ember, moment */ +/*global GLOBE, Handlebars, Em, moment */ /** * @see {@link GLOBE.Formatter.boolean()} */ -Ember.Handlebars.helper('truefalse', function(value){ +Em.Handlebars.helper('truefalse', function(value){ var wrapped = GLOBE.Formatter.boolean(value); return new Handlebars.SafeString(wrapped); }); @@ -10,7 +10,7 @@ Ember.Handlebars.helper('truefalse', function(value){ /** * @see {@link GLOBE.Formatter.bandwidth()} */ -Ember.Handlebars.helper('bandwidth', function(value){ +Em.Handlebars.helper('bandwidth', function(value){ var formatted = GLOBE.Formatter.bandwidth(value); return new Handlebars.SafeString(formatted); }); @@ -18,7 +18,7 @@ Ember.Handlebars.helper('bandwidth', function(value){ /** * Uses {@link GLOBE.static.countries} to get the full name for a country key */ -Ember.Handlebars.registerBoundHelper('fullCountry', function(value){ +Em.Handlebars.registerBoundHelper('fullCountry', function(value){ value = Handlebars.Utils.escapeExpression(value); var fullCountry = ''; @@ -32,7 +32,7 @@ Ember.Handlebars.registerBoundHelper('fullCountry', function(value){ /** * @see {@link GLOBE.Formatter.countryFlag()} */ -Ember.Handlebars.registerBoundHelper('prettyCountryFlag', function(value){ +Em.Handlebars.registerBoundHelper('prettyCountryFlag', function(value){ value = Handlebars.Utils.escapeExpression(value); var countryLabel = GLOBE.Formatter.countryFlag(value); @@ -42,7 +42,7 @@ Ember.Handlebars.registerBoundHelper('prettyCountryFlag', function(value){ /** * @see {@link GLOBE.Formatter.countryFlag()} */ -Ember.Handlebars.registerBoundHelper('flaggifyShort', function(value){ +Em.Handlebars.registerBoundHelper('flaggifyShort', function(value){ value = Handlebars.Utils.escapeExpression(value); var withImage = GLOBE.Formatter.countryFlag(value); return new Handlebars.SafeString(withImage); @@ -51,7 +51,7 @@ Ember.Handlebars.registerBoundHelper('flaggifyShort', function(value){ /** * Generates HTML that displays an flag icon with flag title */ -Ember.Handlebars.registerBoundHelper('flaggifyLong', function(value){ +Em.Handlebars.registerBoundHelper('flaggifyLong', function(value){ var map = GLOBE.static.icons; value = Handlebars.Utils.escapeExpression(value); var withImage = value; @@ -65,7 +65,7 @@ Ember.Handlebars.registerBoundHelper('flaggifyLong', function(value){ * Uses the 'long' variant to generate an uptime string * @see {@title GLOBE.Util.UptimeCalculator} */ -Ember.Handlebars.helper('uptimeFull', function(value){ +Em.Handlebars.helper('uptimeFull', function(value){ if(!value){ return ''; } @@ -78,7 +78,7 @@ Ember.Handlebars.helper('uptimeFull', function(value){ * Uses the 'short' variant to generate an uptime string * @see {@title GLOBE.Util.UptimeCalculator} */ -Ember.Handlebars.helper('uptimeShort', function(value){ +Em.Handlebars.helper('uptimeShort', function(value){ if(!value){ return ''; } @@ -90,7 +90,7 @@ Ember.Handlebars.helper('uptimeShort', function(value){ /** * @see {@link GLOBE.Formatter.extractPort()} */ -Ember.Handlebars.helper('extractPort', function(value){ +Em.Handlebars.helper('extractPort', function(value){ value = Handlebars.Utils.escapeExpression(value); var port = GLOBE.Formatter.extractPort(value); @@ -101,7 +101,7 @@ Ember.Handlebars.helper('extractPort', function(value){ /** * uses {@link http://momentjs.com/docs/#/displaying/fromnow/} to display the difference from now and a given time */ -Ember.Handlebars.helper('fromNow', function(value){ +Em.Handlebars.helper('fromNow', function(value){ var fromNow = '', valMoment = moment(value); @@ -114,6 +114,6 @@ Ember.Handlebars.helper('fromNow', function(value){ /** * @see {@link GLOBE.Formatter.familyToFingerprint()} */ -Ember.Handlebars.helper('familyToFingerprint', function(value){ +Em.Handlebars.helper('familyToFingerprint', function(value){ return new Handlebars.SafeString(GLOBE.Formatter.familyToFingerprint(value)); }); \ No newline at end of file diff --git a/src/js/models/OnionooBandwidthHistory.js b/src/js/models/OnionooBandwidthHistory.js index 286e53f..3446752 100644 --- a/src/js/models/OnionooBandwidthHistory.js +++ b/src/js/models/OnionooBandwidthHistory.js @@ -1,6 +1,6 @@ -/*global $, GLOBE, Ember */ +/*global GLOBE, Em */ -GLOBE.OnionooBandwidthHistory = Ember.Object.extend({}); +GLOBE.OnionooBandwidthHistory = Em.Object.extend({}); GLOBE.OnionooBandwidthHistory.reopenClass({ /** @@ -18,8 +18,8 @@ GLOBE.OnionooBandwidthHistory.reopenClass({ hashedFingerprint = hashedFingerprint.toUpperCase(); - var url = 'https://onionoo.torproject.org/bandwidth?lookup=' + hashedFingerprint; - return $.getJSON(url, {}).then(function(result){ + var url = '/bandwidth?lookup=' + hashedFingerprint; + return GLOBE.getJSON(url).then(function(result){ var relays = { history:{ diff --git a/src/js/models/OnionooDetail.js b/src/js/models/OnionooDetail.js index 883a3b7..19e5b14 100644 --- a/src/js/models/OnionooDetail.js +++ b/src/js/models/OnionooDetail.js @@ -1,9 +1,9 @@ -/*global $, GLOBE, Ember, moment */ +/*global $, GLOBE, Em, moment */ -GLOBE.OnionooRelayDetail = Ember.Object.extend({}); -GLOBE.OnionooBridgeDetail = Ember.Object.extend({}); +GLOBE.OnionooRelayDetail = Em.Object.extend({}); +GLOBE.OnionooBridgeDetail = Em.Object.extend({}); -GLOBE.OnionooDetail = Ember.Object.extend({}); +GLOBE.OnionooDetail = Em.Object.extend({}); GLOBE.OnionooDetail.reopenClass({ applyDetailDefaults: function(result, defaults){ var details = { @@ -101,11 +101,11 @@ GLOBE.OnionooDetail.reopenClass({ advancedParamsString = advancedParamsString.slice(0, -1); // build request url - var url = 'https://onionoo.torproject.org/details?limit=' + GLOBE.static.numbers.maxSearchResults; + var url = '/details?limit=' + GLOBE.static.numbers.maxSearchResults; url += searchParamString + advancedParamsString + fieldParamString; - return $.getJSON(url).then(function(result){ + return GLOBE.getJSON(url).then(function(result){ // getJSON success callback GLOBE.decrementProperty('loading'); @@ -117,7 +117,7 @@ GLOBE.OnionooDetail.reopenClass({ }, function () { // getJSON error callback GLOBE.decrementProperty('loading'); - return GLOBE.static.errors.INVALID_SEARCH_TERM; + throw GLOBE.static.errors.INVALID_SEARCH_TERM; }); }, @@ -145,9 +145,9 @@ GLOBE.OnionooDetail.reopenClass({ GLOBE.incrementProperty('loading'); - var url = 'https://onionoo.torproject.org/details?lookup=' + hashedFingerprint; + var url = '/details?lookup=' + hashedFingerprint; - return $.getJSON(url, {}).then(function(result){ + return GLOBE.getJSON(url).then(function(result){ var detailsObj = that.applyDetailDefaults(result, { relay: GLOBE.defaults.OnionooRelayDetail, bridge: GLOBE.defaults.OnionooBridgeDetail @@ -166,14 +166,9 @@ GLOBE.OnionooDetail.reopenClass({ }); }else{ - var defer = new $.Deferred(); - - setTimeout(function(){ - // wait 4 ms (http://stackoverflow.com/a/9647221) then resolve with stored detail - defer.resolve(storedDetail); - }, 4); - - return defer.promise(); + return new Em.RSVP.Promise(function (resolve) { + resolve(storedDetail); + }); } }, @@ -189,14 +184,14 @@ GLOBE.OnionooDetail.reopenClass({ // right now a fixed order order = '-consensus_weight'; - var url = 'https://onionoo.torproject.org/details?type=relay'; + var url = '/details?type=relay'; url += '&order=' + order; url += '&limit=10'; url += '&fields=' + fields.join(','); url += '&running=true'; GLOBE.incrementProperty('loading'); - return $.getJSON(url).then(function(result){ + return GLOBE.getJSON(url).then(function(result){ GLOBE.decrementProperty('loading'); return that.applyDetailDefaults(result, { diff --git a/src/js/models/OnionooWeightsHistory.js b/src/js/models/OnionooWeightsHistory.js index 60b8bc6..9848348 100644 --- a/src/js/models/OnionooWeightsHistory.js +++ b/src/js/models/OnionooWeightsHistory.js @@ -1,5 +1,5 @@ -/*global $, GLOBE, Ember */ -GLOBE.OnionooWeightsHistory = Ember.Object.extend({}); +/*global GLOBE, Em */ +GLOBE.OnionooWeightsHistory = Em.Object.extend({}); GLOBE.OnionooWeightsHistory.reopenClass({ /** @@ -17,9 +17,9 @@ GLOBE.OnionooWeightsHistory.reopenClass({ hashedFingerprint = hashedFingerprint.toUpperCase(); - var url = 'https://onionoo.torproject.org/weights?lookup=' + hashedFingerprint; + var url = '/weights?lookup=' + hashedFingerprint; - return $.getJSON(url, {}).then(function(result){ + return GLOBE.getJSON(url).then(function(result){ var history = { advertisedBandwidth: {}, consensusWeightFraction: {}, diff --git a/src/js/models/TemporaryStore.js b/src/js/models/TemporaryStore.js index 3d2d036..5b83334 100644 --- a/src/js/models/TemporaryStore.js +++ b/src/js/models/TemporaryStore.js @@ -1,8 +1,8 @@ -/*global GLOBE, Ember */ +/*global GLOBE, Em */ /** * Storage to temporary hold anything */ -GLOBE.TemporaryStore = Ember.Object.extend({}); +GLOBE.TemporaryStore = Em.Object.extend({}); GLOBE.TemporaryStore.reopenClass({ // variable that holds everything diff --git a/src/js/routes/BridgeDetailRoute.js b/src/js/routes/BridgeDetailRoute.js index e9f4676..77e01f5 100644 --- a/src/js/routes/BridgeDetailRoute.js +++ b/src/js/routes/BridgeDetailRoute.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.BridgeDetailRoute = Ember.Route.extend({ +/*global GLOBE, Em */ +GLOBE.BridgeDetailRoute = Em.Route.extend({ model: function(params){ return params.fingerprint; }, diff --git a/src/js/routes/RelayDetailRoute.js b/src/js/routes/RelayDetailRoute.js index 589cdf1..aa69c75 100644 --- a/src/js/routes/RelayDetailRoute.js +++ b/src/js/routes/RelayDetailRoute.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.RelayDetailRoute = Ember.Route.extend({ +/*global GLOBE, Em */ +GLOBE.RelayDetailRoute = Em.Route.extend({ model: function(params){ return params.fingerprint; }, diff --git a/src/js/routes/StaticRoutes.js b/src/js/routes/StaticRoutes.js index b092e18..e49e3a9 100644 --- a/src/js/routes/StaticRoutes.js +++ b/src/js/routes/StaticRoutes.js @@ -1,8 +1,8 @@ -/*global GLOBE, Ember */ +/*global GLOBE, Em */ /** * Route for /index */ -GLOBE.IndexRoute = Ember.Route.extend({ +GLOBE.IndexRoute = Em.Route.extend({ activate: function(){ GLOBE.set('title', ''); } @@ -11,7 +11,7 @@ GLOBE.IndexRoute = Ember.Route.extend({ /** * Route for /code */ -GLOBE.CodeRoute = Ember.Route.extend({ +GLOBE.CodeRoute = Em.Route.extend({ activate: function(){ GLOBE.set('title', 'Code'); } @@ -20,7 +20,7 @@ GLOBE.CodeRoute = Ember.Route.extend({ /** * Route for /help */ -GLOBE.HelpRoute = Ember.Route.extend({ +GLOBE.HelpRoute = Em.Route.extend({ activate: function(){ GLOBE.set('title', 'Help'); } diff --git a/src/js/routes/SummarySearchRoute.js b/src/js/routes/SummarySearchRoute.js index 2a0baa8..1b7e91c 100644 --- a/src/js/routes/SummarySearchRoute.js +++ b/src/js/routes/SummarySearchRoute.js @@ -1,5 +1,5 @@ -/*global $, GLOBE, Ember */ -GLOBE.SummarySearchRoute = Ember.Route.extend({ +/*global $, GLOBE, Em */ +GLOBE.SummarySearchRoute = Em.Route.extend({ // firefox location.hash workaround lastPayload: null, diff --git a/src/js/routes/Top10Route.js b/src/js/routes/Top10Route.js index 5677d4f..5ea90a2 100644 --- a/src/js/routes/Top10Route.js +++ b/src/js/routes/Top10Route.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.Top10Route = Ember.Route.extend({ +/*global GLOBE, Em */ +GLOBE.Top10Route = Em.Route.extend({ activate: function(){ GLOBE.set('title', 'Top 10 relays'); diff --git a/src/js/templates/application.handlebars b/src/js/templates/application.handlebars index 62ab893..2fb85f3 100644 --- a/src/js/templates/application.handlebars +++ b/src/js/templates/application.handlebars @@ -34,7 +34,7 @@

- Want to contribute or view the source? Check out the repository on github. + Want to report a bug, contribute or view the source? Check out the repository on github. "Tor" and the "Onion Logo" are registered trademarks of The Tor Project, Inc.

diff --git a/src/js/templates/toggleEnableViewLayout.handlebars b/src/js/templates/toggleEnableViewLayout.handlebars deleted file mode 100644 index ca2d926..0000000 --- a/src/js/templates/toggleEnableViewLayout.handlebars +++ /dev/null @@ -1,7 +0,0 @@ - - - {{yield}} - \ No newline at end of file diff --git a/src/js/views/HistoryGraphView.js b/src/js/views/HistoryGraphView.js index cf47185..93468cf 100644 --- a/src/js/views/HistoryGraphView.js +++ b/src/js/views/HistoryGraphView.js @@ -1,5 +1,5 @@ -/*global $, Dygraph, GLOBE, Ember */ -GLOBE.HistoryGraphView = Ember.View.extend({ +/*global $, Dygraph, GLOBE, Em */ +GLOBE.HistoryGraphView = Em.View.extend({ title: 'GraphView', templateName: 'graphItem', timePeriod: '1_week', diff --git a/src/js/views/SummariesView.js b/src/js/views/SummariesView.js index 327449c..290f9db 100644 --- a/src/js/views/SummariesView.js +++ b/src/js/views/SummariesView.js @@ -1,5 +1,5 @@ -/*global GLOBE, Ember */ -GLOBE.BaseSummariesView = Ember.View.extend({ +/*global GLOBE, Em */ +GLOBE.BaseSummariesView = Em.View.extend({ tagName: 'table', dataTable: null, data: [], @@ -186,5 +186,5 @@ GLOBE.BridgeSummariesView = GLOBE.BaseSummariesView.extend({ }); // view to hold summary view ( needed for datatables div creation outside the other summariesView ) -GLOBE.SummaryHolderView = Ember.View.extend({ +GLOBE.SummaryHolderView = Em.View.extend({ }); \ No newline at end of file diff --git a/test/ember-test-bootstrap.js b/test/ember-test-bootstrap.js index 22628a2..b1bcf44 100644 --- a/test/ember-test-bootstrap.js +++ b/test/ember-test-bootstrap.js @@ -5,6 +5,16 @@ document.write('
'); document.write(''); + // Test api fixtures + App.TESTING_FIXTURES = { + '/details?limit=50&search=globe integration test search expecting to find nothing&fields=fingerprint,nickname,advertised_bandwidth,last_restarted,country,flags,or_addresses,dir_address,running,hashed_fingerprint': { + 'relays_published':'2013-12-11 20:00:00', + 'relays': [], + 'bridges_published':'2013-12-11 19:37:04', + 'bridges':[] + } + }; + App.rootElement = '#ember-testing'; App.setupForTesting(); App.injectTestHelpers(); diff --git a/test/integration/search.test.js.inactive b/test/integration/search.test.js similarity index 96% rename from test/integration/search.test.js.inactive rename to test/integration/search.test.js index 3c3b4a7..674e154 100644 --- a/test/integration/search.test.js.inactive +++ b/test/integration/search.test.js @@ -5,7 +5,7 @@ module("Search tests", { }); test('the advanced search should not be visible', function () { - var searchQuery = "globe integration test search expecting to find nothing " + Date.now(); + var searchQuery = "globe integration test search expecting to find nothing"; visit('/').then(function () { return fillIn("#main-search", searchQuery);