Package org.auraframework.def

Examples of org.auraframework.def.ComponentDef.validateDefinition()


        String markup = "<aura:clientLibrary name='urlAndTypeMismatch' url='js://clientLibraryTest.clientLibraryTest' type='CSS'/>";
        DefDescriptor<ComponentDef> cmp = addSourceAutoCleanup(ComponentDef.class,
                String.format(baseComponentTag, "", markup));
        try {
            ComponentDef def = cmp.getDef();
            def.validateDefinition();
            fail("Should flag an error when resource type and specified type attribute do not match.");
        } catch (InvalidDefinitionException e) {
            assertEquals("ResourceDef type must match library type", e.getMessage());
        }
    }
View Full Code Here


                descriptor,
                "<aura:component><aura:registerevent name='aura:click' description='The Description' access='fakeAccessLevel'/></aura:component>",
                "myID", Format.XML);
        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Should have thrown AuraException because access level isn't public or global");
        } catch (InvalidDefinitionException e) {

        }
    }
View Full Code Here

                descriptor,
                "<aura:component><aura:registerevent name='aura:click' description='The Description' access='global'>invalidtext</aura:registerevent></aura:component>",
                "myID", Format.XML);
        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Should have thrown AuraException because text is between aura:registerevent tags");
        } catch (InvalidDefinitionException e) {

        }
    }
View Full Code Here

        StringSource<ComponentDef> source = new StringSource<>(
                descriptor,"<aura:component><aura:registerevent name='wheresthetype'/></aura:component>",
                "myID", Format.XML);
      ComponentDef def = parser.parse(descriptor, source);
        try {
          def.validateDefinition();
            fail("Missing type for event should be flagged");
        } catch (Exception e) {
          assertExceptionMessageEndsWith(e, InvalidDefinitionException.class, "type attribute is required on registerevent");
        }
    }
View Full Code Here

                descriptor,
                String.format("<aura:component><aura:registerevent type='%s'/></aura:component>",eventDesc.getDescriptorName()),
                "myID", Format.XML);
      ComponentDef def = parser.parse(descriptor, source);
        try {
          def.validateDefinition();
            fail("Missing name for component event should be flagged");
        } catch (Exception e) {
          assertExceptionMessageEndsWith(e, InvalidDefinitionException.class, "name is a required attribute on tag registerevent");
        }
    }
View Full Code Here

                descriptor,
                String.format("<aura:component><aura:registerevent type='%s'/></aura:component>",eventDesc.getDescriptorName()),
                "myID", Format.XML);
      ComponentDef def = parser.parse(descriptor, source);
        try {
          def.validateDefinition();
            fail("Missing name for application event should be flagged");
        } catch (Exception e) {
          assertExceptionMessageEndsWith(e, InvalidDefinitionException.class, "name is a required attribute on tag registerevent");
        }
    }
View Full Code Here

                "<aura:component><aura:clientLibrary name='HTML5Shiv' type='fooBar' /></aura:component>", "myID",
                Format.XML);

        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Should have failed on encountering bad type attribute");
        } catch (Exception e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "Missing valid type");
        }
    }
View Full Code Here

        StringSource<ComponentDef> source = new StringSource<>(descriptor,
                "<aura:component><aura:clientLibrary name='HTML5Shiv' type='JS, CSS' /></aura:component>", "myID",
                Format.XML);
        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Should accept only valid types for type attribute.");
        } catch (Exception e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "Missing valid type");
        }
    }
View Full Code Here

                        "<aura:clientLibrary name='HTML5Shiv' type='JS' modes='fooBar'/>" +
                        "</aura:component>", "myID",
                Format.XML);
        ComponentDef cd = parser.parse(descriptor, source);
        try {
          cd.validateDefinition();
            fail("Should not accept invalid mode specification.");
        } catch (Exception e) {
            checkExceptionFull(e, InvalidDefinitionException.class, "Invalid mode specified");
        }
    }
View Full Code Here

        StringSource<ComponentDef> source = new StringSource<>(descriptor, "<aura:component>"
                + "<aura:registerevent name='dupName' type='aura:click'/>"
                + "<aura:registerevent name='dupName' type='aura:click'/>" + "</aura:component>", "myID", Format.XML);
        ComponentDef cd = parser.parse(descriptor, source);
        try {
            cd.validateDefinition();
            fail("Should have thrown AuraRuntimeException for registering two events with the same name");
        } catch (Exception e) {
            checkExceptionContains(e, InvalidDefinitionException.class,
                    "Multiple events registered with name");
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.