Able to display tweets (if --disable-web-security used). Needed to patch knockout to survive/ignore properties with dollar sign in them. model
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 08 Apr 2013 09:24:59 +0200
branchmodel
changeset 94835f4f8af296c
parent 947 26f7eeb81aec
child 949 3bd43aa6f08d
Able to display tweets (if --disable-web-security used). Needed to patch knockout to survive/ignore properties with dollar sign in them.
javaquery/api/src/main/resources/org/apidesign/bck2brwsr/htmlpage/knockout-2.2.1.js
javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java
javaquery/demo-twitter/src/main/resources/org/apidesign/bck2brwsr/demo/twitter/index.html
javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java
     1.1 --- a/javaquery/api/src/main/resources/org/apidesign/bck2brwsr/htmlpage/knockout-2.2.1.js	Sun Apr 07 22:32:41 2013 +0200
     1.2 +++ b/javaquery/api/src/main/resources/org/apidesign/bck2brwsr/htmlpage/knockout-2.2.1.js	Mon Apr 08 09:24:59 2013 +0200
     1.3 @@ -2193,7 +2193,14 @@
     1.4                      else
     1.5                          element[attrName] = attrValue;
     1.6                  } else if (!toRemove) {
     1.7 -                    element.setAttribute(attrName, attrValue.toString());
     1.8 +                    try {
     1.9 +                        element.setAttribute(attrName, attrValue.toString());
    1.10 +                    } catch (err) {
    1.11 +                        // ignore for now
    1.12 +                        if (console) {
    1.13 +                            console.log("Can't set attribute " + attrName + " to " + attrValue + " error: " + err);
    1.14 +                        }
    1.15 +                    }
    1.16                  }
    1.17  
    1.18                  // Treat "name" specially - although you can think of it as an attribute, it also needs
     2.1 --- a/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java	Sun Apr 07 22:32:41 2013 +0200
     2.2 +++ b/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java	Mon Apr 08 09:24:59 2013 +0200
     2.3 @@ -47,7 +47,7 @@
     2.4          @Property(name = "from_user_id", type = int.class),
     2.5          @Property(name = "profile_image_url", type = String.class),
     2.6          @Property(name = "text", type = String.class),
     2.7 -        
     2.8 +        @Property(name = "created_at", type = String.class),
     2.9      })
    2.10      static final class Twt {
    2.11      }
     3.1 --- a/javaquery/demo-twitter/src/main/resources/org/apidesign/bck2brwsr/demo/twitter/index.html	Sun Apr 07 22:32:41 2013 +0200
     3.2 +++ b/javaquery/demo-twitter/src/main/resources/org/apidesign/bck2brwsr/demo/twitter/index.html	Mon Apr 08 09:24:59 2013 +0200
     3.3 @@ -52,6 +52,7 @@
     3.4          <div class='liveExample'>
     3.5              <div class='configuration'>
     3.6                  <div class='listChooser'>
     3.7 +                    <button data-bind='click: $root.refreshTweets'>Refresh</button>
     3.8                      <button data-bind='click: deleteList, enable: activeTweeters.name'>Delete</button>
     3.9                      <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button> 
    3.10                      <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
     4.1 --- a/javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java	Sun Apr 07 22:32:41 2013 +0200
     4.2 +++ b/javaquery/demo-twitter/src/test/java/org/apidesign/bck2brwsr/demo/twitter/TwitterProtocolTest.java	Mon Apr 08 09:24:59 2013 +0200
     4.3 @@ -82,6 +82,9 @@
     4.4          }
     4.5  
     4.6          assert 4 == page.getCurrentTweets().size() : "Four tweets: " + page.getCurrentTweets();
     4.7 +        
     4.8 +        String firstDate = page.getCurrentTweets().get(0).getCreated_at();
     4.9 +        assert "Fri, 05 Apr 2013 06:10:01 +0000".equals(firstDate) : "Date is OK: " + firstDate;
    4.10      }
    4.11      
    4.12      @Factory public static Object[] create() {