Changeset 19:ab5f65372038 in pyenvjasmine for pyenvjasmine/envjasmine/samples
- Timestamp:
- Apr 24, 2015, 1:03:31 PM (9 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- pyenvjasmine/envjasmine/samples
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pyenvjasmine/envjasmine/samples/ajaxDemo.js
r0 r19 1 1 // This is the contents of ajaxDemo.js, the file to test. 2 var TwitterWidget = {3 makeRequest: function() {4 var self = this;5 6 $.ajax({7 method: "GET",8 url: "http://api.twitter.com/1/statuses/show/trevmex.json",9 datatype: "json",10 success: function (data) {11 self.addDataToDOM(data);12 }13 });14 },15 2 16 addDataToDOM: function(data) {17 // does something18 // We will mock this behavior with a spy. 19 20 return data; 21 }3 if (typeof(NS) === 'undefined' || !NS) { 4 var NS = {}; 5 } 6 7 NS.greeter = function (name) { 8 return 'Hello ' + name + '!'; 22 9 }; 10 11 NS.greetUser = function (id) { 12 return $.ajax({ 13 data: id, 14 url: 'name.html', 15 success: function (data) { 16 NS.greeter(data.name); 17 } 18 }); 19 }; 20 21 -
pyenvjasmine/envjasmine/samples/demo.js
r0 r19 1 1 // Sample demo 2 2 3 if ( !this.Demo) {4 Demo= {};3 if (typeof(NS) === 'undefined' || !NS) { 4 var NS = {}; 5 5 } 6 6 7 Demo.checkBirthdate = function (user) {8 return !user.birthdate ? false : true;9 } 7 NS.greeter = function (name) { 8 return 'Hello ' + name + '!'; 9 };
Note:
See TracChangeset
for help on using the changeset viewer.