Package org.auraframework.util.javascript.directive

Examples of org.auraframework.util.javascript.directive.DirectiveBasedJavascriptGroup


    /**
     * Test basic javascript generation with IF directives
     */
    public void testJSSourceWithIfDirective() throws Exception {
        File file = getResourceFile("/testdata/javascript/testIfDirective_positive.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy", file.getParentFile(),
                file.getName(), ImmutableList.<DirectiveType<?>> of(DirectiveTypes.ifType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        dp.parseFile();
        goldFileText(dp.generate(JavascriptGeneratorMode.TESTING), "_test.js");
        goldFileText(dp.generate(JavascriptGeneratorMode.PRODUCTION), "_prod.js");
    }
View Full Code Here


            // just to avoid the "local variable never read" error
            assertTrue(id == null);
        }
        try {
            File file = getResourceFile("/testdata/javascript/head.js");
            DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy", file.getParentFile(),
                    file.getName(), ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType),
                    EnumSet.of(JavascriptGeneratorMode.TESTING));
            id = new IncludeDirective(4, config[1]);
            id.processDirective(jg);
            fail("should have failed because 'reallyconkyinclude' is an invalid javascript file to include");
View Full Code Here

    public void testCommonInclude() throws Exception {
        getResourceFile("/testdata/javascript/includeDirective/testCommonInclude.js");
        getResourceFile("/testdata/javascript/includeDirective/testCommonInclude_inner1.js");
        getResourceFile("/testdata/javascript/includeDirective/testCommonInclude_inner2.js");
        getResourceFile("/testdata/javascript/includeDirective/testCommonInclude_commonstuff.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy",
                getResourceFile("/testdata/"), "javascript/includeDirective/testCommonInclude.js",
                ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        dp.parseFile();
        goldFileText(dp.generate(JavascriptGeneratorMode.TESTING), ".js");

    }
View Full Code Here

     * DirectivebasedJavascriptGroup. But having this test here only doubles the
     * number of checks.
     */
    public void testIncludeNonExistingFile() throws Exception {
        File file = getResourceFile("/testdata/javascript/includeDirective/testIncludeNonExistingFile.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy", file.getParentFile(),
                file.getName(), ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        try {
            dp.parseFile();
            fail("Should have failed processing a non-existing file");
        } catch (IOException expected) {
            assertTrue("Add File function failed because of an unexpected error message",
View Full Code Here

    public void testIncludeDirective() throws Exception {
        getResourceFile("/testdata/javascript/includeDirective/testIncludeDirective.js");
        getResourceFile("/testdata/javascript/includeDirective/testIncludeDirective1.js");
        getResourceFile("/testdata/javascript/includeDirective/testIncludeDirective2.js");
        getResourceFile("/testdata/javascript/includeDirective/nestedInclude/testIncludeDirective3.js");
        DirectiveBasedJavascriptGroup jg = new DirectiveBasedJavascriptGroup("testDummy",
                getResourceFile("/testdata/"), "javascript/includeDirective/testIncludeDirective.js",
                ImmutableList.<DirectiveType<?>> of(DirectiveTypes.includeType, DirectiveTypes.ifType),
                EnumSet.of(JavascriptGeneratorMode.TESTING));
        DirectiveParser dp = new DirectiveParser(jg, jg.getStartFile());
        dp.parseFile();
        goldFileText(dp.generate(JavascriptGeneratorMode.TESTING), "_test.js");
        goldFileText(dp.generate(JavascriptGeneratorMode.AUTOTESTING), "_auto.js");
    }
View Full Code Here

        int prefixLength = source_f.getAbsolutePath().length() + 1;
        for(File file : IOUtil.listFiles(source_f, true, true)){
            try {
                String path = file.getAbsolutePath();
                String name = path.substring(prefixLength);
                DirectiveBasedJavascriptGroup group = new DirectiveBasedJavascriptGroup(name,
                        impl_f, path, DIRECTIVES, EnumSet.of(JavascriptGeneratorMode.DOC));
                group.parse();
                group.generate(dest_f, false);
            } catch(Throwable t) {
                System.err.println("Failed to parse "+file.getPath());
                t.printStackTrace();
                System.exit(1);
            }
View Full Code Here

TOP

Related Classes of org.auraframework.util.javascript.directive.DirectiveBasedJavascriptGroup

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.