Search in sources :

Example 26 with Html

use of org.structr.web.entity.html.Html in project structr by structr.

the class DeploymentTest method test19HtmlEntities.

@Test
public void test19HtmlEntities() {
    // setup
    try (final Tx tx = app.tx()) {
        final Page page = Page.createNewPage(securityContext, "test19");
        final Html html = createElement(page, page, "html");
        final Head head = createElement(page, html, "head");
        createElement(page, head, "title", "test19");
        final Body body = createElement(page, html, "body");
        final Div div1 = createElement(page, body, "div");
        final Content content = createContent(page, div1, "<b>Test</b>");
        content.setProperty(StructrApp.key(Content.class, "contentType"), "text/html");
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true, false);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Content(org.structr.web.entity.dom.Content) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) Body(org.structr.web.entity.html.Body) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Example 27 with Html

use of org.structr.web.entity.html.Html in project structr by structr.

the class DeploymentTest method test32RoundtripWithEmptyContentElements.

@Test
public void test32RoundtripWithEmptyContentElements() {
    // setup
    try (final Tx tx = app.tx()) {
        final Page page = Page.createNewPage(securityContext, "test32");
        final Html html = createElement(page, page, "html");
        final Head head = createElement(page, html, "head");
        createElement(page, head, "title", "test32");
        final Body body = createElement(page, html, "body");
        final Div div1 = createElement(page, body, "div");
        final Div div2 = createElement(page, div1, "div", " ");
        final Ul ul = createElement(page, div1, "ul");
        final Li li = createElement(page, ul, "li", " ");
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    compare(calculateHash(), true);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Ul(org.structr.web.entity.html.Ul) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) Body(org.structr.web.entity.html.Body) Li(org.structr.web.entity.html.Li) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Example 28 with Html

use of org.structr.web.entity.html.Html in project structr by structr.

the class DeploymentTest method test40TwoTemplatesWithSameNameInTwoPages.

@Test
public void test40TwoTemplatesWithSameNameInTwoPages() {
    // setup
    try (final Tx tx = app.tx()) {
        // create first page
        final Page page1 = Page.createNewPage(securityContext, "test40_1");
        final Html html1 = createElement(page1, page1, "html");
        final Head head1 = createElement(page1, html1, "head");
        createElement(page1, head1, "title", "test40_1");
        final Body body1 = createElement(page1, html1, "body");
        final Div div1 = createElement(page1, body1, "div");
        // create first template and give it a name
        final Template template1 = createTemplate(page1, div1, "template source - öäüÖÄÜß'\"'`");
        final PropertyMap template1Properties = new PropertyMap();
        template1Properties.put(Template.name, "Test40Template");
        template1.setProperties(template1.getSecurityContext(), template1Properties);
        // create second page
        final Page page2 = Page.createNewPage(securityContext, "test40_2");
        final Html html2 = createElement(page2, page2, "html");
        final Head head2 = createElement(page2, html2, "head");
        createElement(page2, head2, "title", "test40_2");
        final Body body2 = createElement(page2, html2, "body");
        final Div div2 = createElement(page2, body2, "div");
        // create second template and give it the same name as the first one
        final Template template2 = createTemplate(page2, div2, "template source 2 - öäüÖÄÜß'\"'`");
        final PropertyMap template2Properties = new PropertyMap();
        template2Properties.put(Template.name, "Test40Template");
        template2.setProperties(template2.getSecurityContext(), template2Properties);
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) PropertyMap(org.structr.core.property.PropertyMap) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) Body(org.structr.web.entity.html.Body) Template(org.structr.web.entity.dom.Template) MailTemplate(org.structr.core.entity.MailTemplate) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Aggregations

Test (org.junit.Test)28 FrameworkException (org.structr.common.error.FrameworkException)28 Tx (org.structr.core.graph.Tx)28 StructrUiTest (org.structr.web.StructrUiTest)28 Page (org.structr.web.entity.dom.Page)28 Body (org.structr.web.entity.html.Body)28 Head (org.structr.web.entity.html.Head)28 Html (org.structr.web.entity.html.Html)28 Div (org.structr.web.entity.html.Div)22 MailTemplate (org.structr.core.entity.MailTemplate)10 Template (org.structr.web.entity.dom.Template)10 Content (org.structr.web.entity.dom.Content)7 PropertyMap (org.structr.core.property.PropertyMap)5 DOMNode (org.structr.web.entity.dom.DOMNode)5 GraphObject (org.structr.core.GraphObject)3 Principal (org.structr.core.entity.Principal)3 NodeAttribute (org.structr.core.graph.NodeAttribute)3 User (org.structr.web.entity.User)3 Script (org.structr.web.entity.html.Script)3 Table (org.structr.web.entity.html.Table)3