Changeset 19:ab5f65372038 in pyenvjasmine for pyenvjasmine/envjasmine/samples


Ignore:
Timestamp:
Apr 24, 2015, 1:03:31 PM (9 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Imported latest envjasmine version, the initial import from darcs had the wrong version

Location:
pyenvjasmine/envjasmine/samples
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • pyenvjasmine/envjasmine/samples/ajaxDemo.js

    r0 r19  
    11// 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     },
    152
    16     addDataToDOM: function(data) {
    17         // does something
    18         // We will mock this behavior with a spy.
    19        
    20         return data;
    21     }
     3if (typeof(NS) === 'undefined' || !NS) {
     4    var NS = {};
     5}
     6
     7NS.greeter = function (name) {
     8    return 'Hello ' + name + '!';
    229};
     10
     11NS.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  
    11// Sample demo
    22
    3 if (!this.Demo) {
    4     Demo = {};
     3if (typeof(NS) === 'undefined' || !NS) {
     4    var NS = {};
    55}
    66
    7 Demo.checkBirthdate = function (user) {
    8     return !user.birthdate ? false : true;
    9 }
     7NS.greeter = function (name) {
     8    return 'Hello ' + name + '!';
     9};
Note: See TracChangeset for help on using the changeset viewer.