Package com.google.sitebricks

Examples of com.google.sitebricks.Respond$HtmlTagBuilder


//    @Test
    public final void textTagRender() {

        final String[] out = new String[1];
        Respond mockRespond = createMock(Respond.class);
        final String boundTo = "aString";

        new TextFieldWidget(new ProceedingWidgetChain(), "boundTo", new MvelEvaluator())
                .render(new HashMap<String, Object>() {{
                    put("boundTo", boundTo);
View Full Code Here


    injector = Guice.createInjector(new SitebricksModule());
  }

  @Test
  public final void storeAndRetrievePageInstance() {
    final Respond respond = new MockRespond();

    Renderable mock = new Renderable() {
      public void render(Object bound, Respond respond) {

      }
View Full Code Here

    };
  }

  @Test(dataProvider = URI_TEMPLATES_AND_MATCHES)
  public final void matchPageByUriTemplate(final String template, final String toMatch) {
    final Respond respond = new MockRespond();

    Renderable mock = new Renderable() {
      public void render(Object bound, Respond respond) {

      }
View Full Code Here

//              "\n</body></html>");


    assert null != widget : " null ";

    final Respond mockRespond = RespondersForTesting.newRespond();
//        final Respond mockRespond = new StringBuilderRespond() {
//            @Override
//            public void write(String text) {
//                builder.append(text);
//            }
//
//            @Override
//            public void write(char text) {
//                builder.append(text);
//            }
//
//            @Override
//            public void chew() {
//                builder.deleteCharAt(builder.length() - 1);
//            }
//        };

    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;
    // assert "<!doctype html><html><head><meta charset=\"UTF-8\"><title>small test</title></head><body><p>hello</p></body></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

  public final void readAWidgetWithVariousExpressions(String expression) {   
    Renderable widget = compiler()
        .compile(Object.class, new Template(String.format("<html>@ShowIf(%s)<p>hello</p></html>", expression)));
   
    assert null != widget : " null ";   
    final Respond mockRespond = RespondersForTesting.newRespond();   
    widget.render(new Object(), mockRespond);   
    final String value = mockRespond.toString();   
    assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

    Renderable widget = compiler()
        .compile(Object.class, new Template("<html>@ShowIf(false)<p>hello</p></html>"));

    assert null != widget : " null ";
    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

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

    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>"
        .replaceAll("'", "\"")
        .equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

                "</head><body>" +
                "<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>" +
        "<div class='content'>hello <a href='/people/12'>Dhanji</a></div></body></html>";
    expected = expected.replaceAll("'", "\"");
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>");
  }
View Full Code Here

TOP

Related Classes of com.google.sitebricks.Respond$HtmlTagBuilder

Copyright © 2018 www.massapicom. 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.