/** * testStringF * * @throws IOException */ @Test public void testStringFPrefix() throws IOException { File bundleFile = FileUtil.createTempFile("editor_unit_tests", "rb"); BundleElement bundleElement = new BundleElement(bundleFile.getAbsolutePath()); bundleElement.setDisplayName("Editor Unit Tests"); File f = FileUtil.createTempFile("snippet", "rb"); SnippetElement se = createSnippet(f.getAbsolutePath(), "FunctionTemplate", "fun", "source.js"); bundleElement.addChild(se); BundleManager.getInstance().addBundle(bundleElement); try { // note template is before true proposal, as we are ordering by trigger prefix this.checkProposals( "contentAssist/f-prefix.js", true, true, "false", "finally", "focus", "for", "forward", "frames", "function", "FunctionTemplate", "Function"); } finally { BundleManager.getInstance().unloadScript(f); } }
/** * testStringFunction * * @throws IOException */ public void testBackgroundProposals() throws IOException { File bundleFile = File.createTempFile("editor_unit_tests", "rb"); bundleFile.deleteOnExit(); BundleElement bundleElement = new BundleElement(bundleFile.getAbsolutePath()); bundleElement.setDisplayName("Editor Unit Tests"); File f = File.createTempFile("snippet", "rb"); SnippetElement se = createSnippet(f.getAbsolutePath(), "background-color-template", "background", "source.css"); bundleElement.addChild(se); BundleManager.getInstance().addBundle(bundleElement); // note template is interleaved into proposals this.checkProposals( "contentAssist/background.css", true, true, "backface-visibility", "background", "background-attachment", "background-clip", "background-color", "background-color-template", "background-image", "background-origin", "background-position", "background-position-x", "background-position-y", "background-repeat", "background-size"); BundleManager.getInstance().unloadScript(f); }
/** * testStringFunction * * @throws IOException */ @Test public void testStringThis() throws IOException { File bundleFile = FileUtil.createTempFile("editor_unit_tests", "rb"); BundleElement bundleElement = new BundleElement(bundleFile.getAbsolutePath()); bundleElement.setDisplayName("Editor Unit Tests"); File f = FileUtil.createTempFile("snippet", "rb"); SnippetElement se = createSnippet(f.getAbsolutePath(), "$(this)", "this", "source.js"); bundleElement.addChild(se); BundleManager.getInstance().addBundle(bundleElement); this.checkProposals("contentAssist/this.js", true, true, "$(this)", "this", "throw"); BundleManager.getInstance().unloadScript(f); }