Package org.auraframework.impl.expression

Examples of org.auraframework.impl.expression.PropertyReferenceImpl


        // attribute is in caps
        DefDescriptor<ComponentDef> childDesc = addSourceAutoCleanup(ComponentDef.class, String.format(
                baseComponentTag, String.format("extends='%s'", parentDesc.getDescriptorName()),
                "<aura:set attribute='PARENTATTR' value='godmother'/>"));
        Component childCmp = Aura.getInstanceService().getInstance(childDesc);
        assertEquals("mother", childCmp.getValue(new PropertyReferenceImpl("v.parentAttr", AuraUtil
                .getExternalLocation("direct attributeset access"))));
        assertEquals(
                "godmother",
                childCmp.getSuper().getValue(
                        new PropertyReferenceImpl("v.parentAttr", AuraUtil
                                .getExternalLocation("direct attributeset access"))));

        // 2. Attribute reference of facets in markup
        DefDescriptor<ComponentDef> outerCmpDesc = addSourceAutoCleanup(
                ComponentDef.class,
                String.format(baseComponentTag, "",
                        String.format("<%s PARENTATTR='godfather'/>", parentDesc.getDescriptorName())));
        Component outerCmp = Aura.getInstanceService().getInstance(outerCmpDesc);
        Component innerCmp = extractFacetsFromComponent(outerCmp).get(0);
        assertEquals(parentDesc.getQualifiedName(), innerCmp.getDescriptor().getQualifiedName());
        assertEquals("godfather", innerCmp.getValue(new PropertyReferenceImpl("v.parentAttr", AuraUtil
                .getExternalLocation("direct attributeset access"))));

        // 3. Attribute reference of facets using aura:set
        DefDescriptor<ComponentDef> outerCmpUsingSetAttributeDesc = addSourceAutoCleanup(ComponentDef.class,
                String.format(baseComponentTag, "", String.format(
                        "<%1$s> <aura:set attribute='PARENTATTR' value='evilfather'/> </%1$s>",
                        parentDesc.getDescriptorName())));
        outerCmp = Aura.getInstanceService().getInstance(outerCmpUsingSetAttributeDesc);
        innerCmp = extractFacetsFromComponent(outerCmp).get(0);
        assertEquals(parentDesc.getQualifiedName(), innerCmp.getDescriptor().getQualifiedName());
        assertEquals("evilfather", innerCmp.getValue(new PropertyReferenceImpl("v.parentAttr", AuraUtil
                .getExternalLocation("direct attributeset access"))));

    }
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    private ArrayList<Component> extractFacetsFromComponent(Component c) throws Exception {
        Object body = c.getValue(new PropertyReferenceImpl("v.body", AuraUtil
                .getExternalLocation("direct attributeset access")));
        if (body == null) {
            body = c.getSuper().getValue(
                    new PropertyReferenceImpl("v.body", AuraUtil.getExternalLocation("direct attributeset access")));
        }
        if (body == null) {
            return null;
        }
        assertTrue(body instanceof ArrayList);
View Full Code Here

        assertEquals(expectedValue, defaultValue);

        // Also validate that the default appropriately shows up on an instance
        // of this model.
        Model model = def.newInstance();
        Object instanceValue = model.getValue(new PropertyReferenceImpl(name, null));
        assertEquals(expectedValue, instanceValue);

        // Make sure that the instance value was cloned so that changes to the
        // instance value don't affect other instances or the default.
        // This check doesn't work well for booleans or Strings.
View Full Code Here

                ComponentDef.class,
                String.format(baseComponentTag, "",
                        "<aura:attribute name='pairAttr' type='java://org.auraframework.util.type.CustomPairType' default='HouseNo$300'/>"));
        Component cmp = Aura.getInstanceService().getInstance(cmpDesc);
        assertEquals("Failed to convert attribute default value to custom data type object.", new CustomPairType(
                "HouseNo", 300), cmp.getValue(new PropertyReferenceImpl("v.pairAttr", AuraUtil
                .getExternalLocation("direct attributeset access"))));
    }
View Full Code Here

        super(name);
    }

    public void testSerialize() throws Exception {
        EventHandlerDefImpl eventHandlerDef2 = vendor.makeEventHandlerDefWithNulls(
                vendor.makeEventDefDescriptor("auratest:testevent"), new PropertyReferenceImpl("c.foo", null),
                vendor.makeLocation("filename", 5, 5, 0));
        serializeAndGoldFile(eventHandlerDef2);
    }
View Full Code Here

TOP

Related Classes of org.auraframework.impl.expression.PropertyReferenceImpl

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.