Package com.google.sitebricks

Examples of com.google.sitebricks.Renderable.render()


                "<div class='${clazz}'>hello <a href='/people/${id}'>${name}</a></div>" +
                "</body></html>"));
   
    assert null != widget : " null ";
    final Respond respond = RespondersForTesting.newRespond();
    widget.render(new TestBackingType("Dhanji", "content", 12), respond);

    final String value = respond.toString();
    String expected = "<html> <head>" +
        "      <script type='text/javascript' src='my.js'></script>" +
        "</head><body>" +
View Full Code Here


    Renderable widget = compiler()
        .compile(TestBackingType.class, new Template("<html><div class='${clazz}'>hello</div></html>"));

    assert null != widget : " null ";
    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
    final String s = mockRespond.toString();
    assert "<html><div class=\"content\">hello</div></html>"
        .equals(s) : "Did not write expected output, instead: " + s;
  }
View Full Code Here

    Renderable widget = compiler()
        .compile(TestBackingType.class, new Template("<!doctype html><html><body><div class='${clazz}'>hello @ShowIf(false)<a href='/hi/${id}'>hideme</a></div></body></html>"));

    assert null != widget : " null ";
    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
    final String s = mockRespond.toString();
    assertEquals(s, "<!doctype html><html><body><div class=\"content\">hello </div></body></html>");
  }

  @EmbedAs(MyEmbeddedPage.MY_FAVE_ANNOTATION)
View Full Code Here

    //tell pagebook to track this as an embedded widget
    pageBook.embedAs(MyEmbeddedPage.class, MyEmbeddedPage.MY_FAVE_ANNOTATION)
        .apply(Chains.terminal());

    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
    final String s = mockRespond.toString();
    assert "<xml><div class=\"content\">hello </div></xml>"
        .equals(s) : "Did not write expected output, instead: " + s;
  }
View Full Code Here

    pageBook.embedAs(MyEmbeddedPage.class, MyEmbeddedPage.MY_FAVE_ANNOTATION)
        .apply(Chains.terminal());

    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);

    final String s = mockRespond.toString();
    assert "<html><div class=\"content\">hello </div></html>"
        .equals(s) : "Did not write expected output, instead: " + s;
  }
View Full Code Here

    }
    Preconditions.checkArgument(null != compiled, "No template found attached to: %s", clazz);

    StringBuilderRespond respond = new StringBuilderRespond(context);
    //noinspection ConstantConditions
    compiled.render(context, respond);

    return respond.toString();
  }

  public static class Descriptor {
View Full Code Here

    assert null != widget : " null ";

    final StringBuilder builder = new StringBuilder();
    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new Object(), mockRespond);
    final String value = mockRespond.toString();
    System.out.println(value);
    assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

    final StringBuilder builder = new StringBuilder();

    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new Object(), mockRespond);

    final String value = mockRespond.toString();
    System.out.println(value);
    assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

    assert null != widget : " null ";

    final StringBuilder builder = new StringBuilder();

    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new Object(), mockRespond);

    final String value = mockRespond.toString();
    assert "<html></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

    assert null != widget : " null ";


    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);

    final String value = mockRespond.toString();
    assert "<html><div class='content'>hello <a href='/people/12'>Dhanji</a></div></html>"
        .replace("\"", "'")
        .equals(value) : "Did not write expected output, instead: " + value;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.