Package org.auraframework.def

Examples of org.auraframework.def.ComponentDef


     * @expectedResults No rendererDef section found in componentDef
     */
    public void testComponentDefWhenRedererIsJava() throws Exception {
        DefDescriptor<ComponentDef> d = Aura.getDefinitionService().getDefDescriptor("test:test_SimpleJavaRenderer",
                ComponentDef.class);
        ComponentDef def = d.getDef();
        // Convert the definition to a format that is used by the client
        String defInJson = Json.serialize(def, false, true);
        // Convert back to the object, just like the client does in javascript
        Object defObj = new JsonReader().read(defInJson);
        assertTrue(defObj instanceof Map);
View Full Code Here


        events.put("keydown", "markup://ui:keydown");
        events.put("keypress", "markup://ui:keypress");
        events.put("keyup", "markup://ui:keyup");
        events.put("select", "markup://ui:select");

        ComponentDef def = Aura.getDefinitionService().getDefinition("ui:input", ComponentDef.class);
        assertNotNull("Failed to retrieve definition of ui:input", def);
        Map<String, RegisterEventDef> registeredEvents = def.getRegisterEventDefs();
        RegisterEventDef registeredEvent;
        for (String eventName : events.keySet()) {
            registeredEvent = registeredEvents.get(eventName);
            assertNotNull("ui:input is not registered to fire event named: " + eventName, registeredEvent);
            assertEquals(
View Full Code Here

        return ret;
    }

    private ComponentDef getUiOutputComponent() throws Exception {
        DefinitionService definitionService = Aura.getDefinitionService();
        ComponentDef def = definitionService.getDefinition("markup://ui:output", ComponentDef.class);
        return def;
    }
View Full Code Here

        events.put("keypress", "markup://ui:keypress");
        events.put("keyup", "markup://ui:keyup");
        events.put("select", "markup://ui:select");

        Aura.getContextService().startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
        ComponentDef def = getUiOutputComponent();
        Map<String, RegisterEventDef> registeredEvents = def.getRegisterEventDefs();

        RegisterEventDef registeredEvent;
        for (String eventName : events.keySet()) {
            registeredEvent = registeredEvents.get(eventName);
            assertNotNull("ui:output is not registered to fire event named: " + eventName, registeredEvent);
View Full Code Here

        // But are part of Dom Events
        List<String> events = new ArrayList<>();
        events.add("change");

        Aura.getContextService().startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
        ComponentDef def = getUiOutputComponent();
        Map<String, RegisterEventDef> registeredEvents = def.getRegisterEventDefs();
        RegisterEventDef registeredEvent;

        Iterator<String> iterator = events.iterator();
        while (iterator.hasNext()) {
            String eventName = iterator.next().toString();
View Full Code Here

    /**
     * Verify that iteams, var and body are required attributes.
     */
    public void testRequiredAttributes() throws Exception {
        ComponentDef def = Aura.getDefinitionService().getDefinition("aura:iteration", ComponentDef.class);
        assertNotNull(def);
        assertTrue("Cannot use iteration component with something to iterate through.", def.getAttributeDef("items")
                .isRequired());
        assertTrue("Require a reference variable to iterate.", def.getAttributeDef("var").isRequired());
        assertTrue("Require a template to put in components for each iteration.", def.getAttributeDef("body")
                .isRequired());
    }
View Full Code Here

        "<aura:description>random description</aura:description>" +
        "<aura:example name='example' ref='"+exampleCmp+"' label='label1'>random example</aura:example>"
        "</aura:documentation>";

    DefDescriptor<DocumentationDef> dd= addSourceAutoCleanup(DocumentationDef.class, docDefSource);
    ComponentDef cd = dd.getDef().getExampleDefs().get(0).getRef().getDef();
    assertEquals("Unable to get to the ComponentDef referenced in example!", exampleCmp, cd.getDescriptor().getNamespace()+":"+cd.getName());
  }
View Full Code Here

        StyleDef styleDef = styleDesc.getDef();
        assertEquals("css://ui.button", styleDef.toString());

        DefDescriptor<ComponentDef> cmpDesc = definitionService.getDefDescriptor("ui:button", ComponentDef.class);
        assertEquals("markup://ui:button", cmpDesc.toString());
        ComponentDef componentDef = cmpDesc.getDef();
        assertEquals("markup://ui:button", componentDef.toString());

        // we can get all definitions the button depends on
        List<DefDescriptor<ControllerDef>> controllerDescs = componentDef.getControllerDefDescriptors();
        assertEquals(1, controllerDescs.size());
        DefDescriptor<ControllerDef> controllerDesc = controllerDescs.get(0);
        assertEquals("js://ui.button", controllerDesc.toString());
        JavascriptControllerDef controllerDef = (JavascriptControllerDef) controllerDesc.getDef();
        String controllerDefFileName = controllerDef.getLocation().getFileName();
        assertTrue(controllerDefFileName, controllerDefFileName.endsWith("/ui/button/buttonController.js"));
        // we can use getBundle to get all descriptors in the bundle
        List<DefDescriptor<?>> bundleDescs = componentDef.getBundle();
        assertEquals(3, bundleDescs.size());
        assertTrue(bundleDescs.contains(controllerDesc));

        // finding java definitions
        DefDescriptor<TypeDef> javaDescriptor = definitionService.getDefDescriptor(
View Full Code Here

     *
     * @priority high
     * @throws Exception
     */
    public void testDefaultNamingConventionForHelper() throws Exception {
        ComponentDef cmpDef = Aura.getDefinitionService().getDefinition("test:test_SimpleHelper", ComponentDef.class);
        assertNotNull(cmpDef);
        HelperDef hlprDef = cmpDef.getHelperDef();
        assertNotNull("Failed to extract helper def on component.", hlprDef);
        assertTrue("By default BaseComponentDefHandler shoud assume that a component has a javascript helper.",
                hlprDef instanceof JavascriptHelperDef);
        assertEquals("Failed to create correct helper def for test component.", "js://test.test_SimpleHelper", hlprDef
                .getDescriptor().getQualifiedName());
View Full Code Here

    // TODO: Should we not know at the server side that the parent has helper
    // defs, why do we do it only clientside?
    // Also, looks like we are going to support serverside helpers since
    // HelperDef has a isLocal() method.
    public void _testInheritedHelpers() throws Exception {
        ComponentDef cmpDef = Aura.getDefinitionService().getDefinition("test:testJSHelperInheritedOnly",
                ComponentDef.class);

        HelperDef hlprDef = cmpDef.getHelperDef();
        assertNotNull("Failed to extract helper def inherited from parent component.", hlprDef);
        assertTrue("failed to recognize javascript helper def on parent.", hlprDef instanceof JavascriptHelperDef);
        assertEquals("Failed to use parent's helper def.", "js://test.testJSHelperSuper", hlprDef.getDescriptor()
                .getQualifiedName());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.def.ComponentDef

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.