Package org.auraframework.instance

Examples of org.auraframework.instance.Component


    public void testIndexVarShadowError() throws Exception {
        String source = "<aura:attribute name='other' type='String' default='huzzah'/><aura:iteration items='{!v.items}' var='x' indexVar='v'>{!x}{!v}{!v.other}|</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        try {
            getRenderedBaseComponent(iteration);
            fail("Expected a AuraExecutionException");
        } catch (Exception e) {
            checkExceptionContains(e, AuraExecutionException.class, "no such property: other");
View Full Code Here


    public void testStartGreaterThanLength() throws Exception {
        String source = "<aura:iteration start='4' items='{!v.items}' var='x' indexVar='i'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testStartNegative() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='x' indexVar='i' start='-9'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("0q|1r|2s|", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testStartGreaterThanEnd() throws Exception {
        String source = "<aura:iteration start='1' end='0' items='{!v.items}' var='x' indexVar='i'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testStartDecimal() throws Exception {
        String source = "<aura:iteration start='1.1' items='{!v.items}' var='x' indexVar='i'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("1r|2s|", getRenderedBaseComponent(iteration));
        assertEquals(1, iteration.getAttributes().getValue("start"));
    }
View Full Code Here

    public void testEndGreaterThanLength() throws Exception {
        String source = "<aura:iteration end='4' items='{!v.items}' var='x' indexVar='i'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("0q|1r|2s|", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testEndNegative() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='x' indexVar='i' end='-9'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testEndDecimal() throws Exception {
        String source = "<aura:iteration end='2.2' items='{!v.items}' var='x' indexVar='i'>{!i}{!x+'|'}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("0q|1r|", getRenderedBaseComponent(iteration));
        assertEquals(2, iteration.getAttributes().getValue("end"));
    }
View Full Code Here

                "'String'", "'default attributeFromChildToGrandChild'");
        DefDescriptor<ComponentDef> defDesChild = getDefDescriptorExtend
                (defDesParent.getDescriptorName(), "attributeInChild", "default attribute in Child",
                        attributeFromChildToGrandChild, "{!v.attributeInChild}", cmpGrandChild);

        Component childCmp = Aura.getInstanceService().getInstance(defDesChild, attributes);

        String result =
                "<br/>ParentCMP<br/>m.valueParent=defaultattributeinChild" +
                        "<br/>GrandCHILDCMP<br/>" +
                        "<br/>ParentCMP<br/>m.valueParent=defaultattributeFromChildToGrandChild" +
                        "<br/>GrandCHILDCMP<br/>";
        if (testModelWithCount) {
            assertEquals(2, TestReinitializeModelWithCount.getCount());
            TestReinitializeModelWithCount.clearCount();
        } else {
            assertEquals(result, getRenderedBaseComponent(childCmp).replaceAll("\\s+", ""));
        }

        Map<String, Object> newAttributes = Maps.newHashMap();
        newAttributes.put("attributeFromChildToGrandChild", "new attributeFromChildToGrandChild");
        newAttributes.put("attributeInChild", "new attribute in Child");
        childCmp.getAttributes().set(newAttributes);
        childCmp.reinitializeModel();

        if (testModelWithCount) {
            assertEquals(2, TestReinitializeModelWithCount.getCount());
            TestReinitializeModelWithCount.clearCount();
        } else {
View Full Code Here

        Map<String, Object> attributes = Maps.newHashMap();
        DefDescriptor<ComponentDef> def = addSourceAutoCleanup(ComponentDef.class, String.format(
                "<aura:component render=\"client\">" +
                        attributeInMain1 + attributeInMain2 + attributeInMain3 +
                        "MAIN CMP%s</aura:component>", source));
        Component mainCMP = Aura.getInstanceService().getInstance(def, attributes);

        String result = "MAINCMP" +
                "<br/>ParentCMP<br/>m.valueParent=defaultattributeInMain1" +
                "<br/>ParentCMP<br/>m.valueParent=defaultattributeInMain2" +
                "<br/>ParentCMP<br/>m.valueParent=defaultattributeInMain3";

        if (testModelWithCount) {
            assertEquals(3, TestReinitializeModelWithCount.getCount());
            TestReinitializeModelWithCount.clearCount();
        } else {
            assertEquals(result, getRenderedBaseComponent(mainCMP).replaceAll("\\s+", ""));
        }
        Map<String, Object> newAttributes = Maps.newHashMap();
        newAttributes.put("attributeInMain1", "new attribute In Main1");
        newAttributes.put("attributeInMain2", "new attribute In Main2");
        newAttributes.put("attributeInMain3", "new attribute In Main3");
        mainCMP.getAttributes().set(newAttributes);
        mainCMP.reinitializeModel();

        if (testModelWithCount) {
            assertEquals(3, TestReinitializeModelWithCount.getCount());
            TestReinitializeModelWithCount.clearCount();
        } else {
View Full Code Here

TOP

Related Classes of org.auraframework.instance.Component

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.