Package org.auraframework.instance

Examples of org.auraframework.instance.Component


    }

    private Component getIterationComponent(String innerSource, Map<String, Object> attributes) throws Exception {
        DefDescriptor<ComponentDef> def = addSourceAutoCleanup(ComponentDef.class, String.format(
                "<aura:component><aura:attribute name='items' type='List'/>%s</aura:component>", innerSource));
        Component cmp = Aura.getInstanceService().getInstance(def, attributes);
        return (Component) ((List<?>) cmp.getSuper().getAttributes().getValue("body")).get(0);
    }
View Full Code Here


    public void testItemsNull() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='x'>{!x}lalala</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", null);
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testItemsEmpty() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='x'>{!x}lalala</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Collections.EMPTY_LIST);
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("", getRenderedBaseComponent(iteration));
    }
View Full Code Here

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

    @Ignore("W-1300971")
    public void _testVarWithPeriod() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='my.prop'>{!my.prop}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("qrs", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testVarShadow() throws Exception {
        String source = "<aura:attribute name='other' type='String' default='huzzah'/><aura:iteration items='{!v.items}' var='v' indexVar='i'>{!i}{!v}|</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 testVarShadowError() throws Exception {
        String source = "<aura:attribute name='other' type='String' default='huzzah'/><aura:iteration items='{!v.items}' var='v' indexVar='i'>{!i}{!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 testIndexVarEmpty() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='x' indexVar=''>{!x}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("qrs", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    @Ignore("W-1300971")
    public void _testIndexVarWithPeriod() throws Exception {
        String source = "<aura:iteration items='{!v.items}' var='x' indexVar='my.prop'>{!my.prop}</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("012", getRenderedBaseComponent(iteration));
    }
View Full Code Here

    public void testIndexVarShadow() throws Exception {
        String source = "<aura:attribute name='other' type='String' default='huzzah'/><aura:iteration items='{!v.items}' var='x' indexVar='v'>{!x}{!v}|</aura:iteration>";
        Map<String, Object> attributes = Maps.newHashMap();
        attributes.put("items", Lists.newArrayList("q", "r", "s"));
        Component iteration = getIterationComponent(source, attributes);
        assertEquals("q0|r1|s2|", getRenderedBaseComponent(iteration));
    }
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.