Package com.google.collide.client.code.autocomplete

Examples of com.google.collide.client.code.autocomplete.MockAutocompleterEnvironment


    helper.autocompleter.reallyFinishAutocompletion(proposals.select(1));
    assertEquals(prologue + "delete \n" + epilogue, helper.editor.getDocument().asText());
  }

  public void testJavascriptFindAutocompletionsSeesFunctionInCodegraph() {
    MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    // Something like function aFoo() {}
    CodeBlockImpl aFoo = MockCodeBlockImpl
        .make()
        .setBlockType(CodeBlock.Type.VALUE_FUNCTION)
View Full Code Here


    assertEquals(5, proposals.size());
    assertEquals("aFoo", proposals.get(1).getName());
  }

  public void testJavascriptGetExplicitAutocompletion() {
    MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    setupHelper(helper, "<html><body><script type=\"text/javascript\">foo");
    Line line = helper.editor.getDocument().getLastLine();
    JsonArray<Token> tokens = helper.parser.parseLineSync(line);
    assertEquals("html", tokens.get(0).getMode());
View Full Code Here

    defaultResult = (DefaultAutocompleteResult) result;
    assertEquals("()", defaultResult.getAutocompletionText());
  }

  public void testPopupDoNotAnnoyUsers() {
    final MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    helper.setup(new PathUtil("foo.html"),
        "<html>\n <body>\n  <script>\n\n  </script>\n </body>\n</html>", 3, 0, true);
    ExplicitActionType action = helper.autocompleter.htmlAutocompleter.getExplicitAction(
        helper.editor.getSelection(), new SignalEventEssence(' '), false).getType();
    assertTrue("no popup before mode is determined", action == ExplicitActionType.DEFAULT);
View Full Code Here

        helper.editor.getSelection(), new SignalEventEssence(' '), false).getType();
    assertTrue("no popup in JS mode", action == ExplicitActionType.DEFAULT);
  }

  public void testNoPopupAfterClosingTag() {
    final MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    helper.setup(new PathUtil("foo.html"), "<html>\n <script\n<body style=''>\n", 2, 8, true);

    helper.parser.getListenerRegistrar().add(new DocumentParserListenerAdapter(
        helper.autocompleter, helper.editor));
    helper.parser.begin();
    helper.parseScheduler.requests.pop().run(10);
View Full Code Here

   *
   * <p>As a consequence, xml-analyzer may interpret the following
   * content "inside-out".
   */
  public void testScriptTagDoNotConfuseXmlProcessing() {
    MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    helper.setup(new PathUtil("foo.html"),
        "<html>\n <script></script>\n <body>\n", 2, 7, true);

    helper.parser.getListenerRegistrar().add(new DocumentParserListenerAdapter(
        helper.autocompleter, helper.editor));
    helper.parser.begin();
View Full Code Here

   *
   * <p>This situation could confuse autocompleter and cause unwanted popup
   * when user press space just after "&gt;".
   */
  public void testNoJsPopupOnAfterSpace() {
    MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    helper.setup(new PathUtil("foo.html"),
        "<html>\n <script>\n", 1, 9, true);

    helper.parser.getListenerRegistrar().add(new DocumentParserListenerAdapter(
        helper.autocompleter, helper.editor));
    helper.parser.begin();
View Full Code Here

   * is not parsed yet.
   *
   * <p>Previously we got NPE in this case.
   */
  public void testNoProposalsOnGrayLine() {
    MockAutocompleterEnvironment helper = new MockAutocompleterEnvironment();

    helper.setup(new PathUtil("foo.html"),
        "<html>\n <body>\n  <di", 2, 5, true);

    helper.parser.getListenerRegistrar().add(new DocumentParserListenerAdapter(
        helper.autocompleter, helper.editor));
    helper.parser.begin();
View Full Code Here

TOP

Related Classes of com.google.collide.client.code.autocomplete.MockAutocompleterEnvironment

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.