Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context assistant does not call provider in some text node positions #55

Open
vadson71 opened this issue Dec 9, 2019 · 1 comment
Open
Assignees
Labels
bug Something isn't working Content Assist

Comments

@vadson71
Copy link
Contributor

vadson71 commented Dec 9, 2019

Text content provider not called in positions right before opening tag and immediately following closing tag.

The following tests help to identify the problem.

  it("in position immediately following a closing tag", () => {
    const sample =
      `<person address="NY">\n` +
      `\t<firstname>Anna</firstname>⇶\n` +
      `\t<lastname>Smith</lastname>\n` +
      `</person>`;

    let providerCalled = false;
    getSampleSuggestions(sample, {
      attributeName: [
        ({ element, attribute, prefix }) => {
          expect(element.name).to.eql("person");
          expect(attribute).to.be.undefined;
          expect(prefix).to.be.undefined;
          providerCalled = true;
        }
      ]
    });
    expect(providerCalled).to.be.true;
  });

  it("in position right before an opening tag", () => {
    const sample =
      `<person address="NY">\n` +
      `\t<firstname>Anna</firstname>\n` +
      `\t⇶<lastname>Smith</lastname>\n` +
      `</person>`;

    let providerCalled = false;
    getSampleSuggestions(sample, {
      attributeName: [
        ({ element, attribute, prefix }) => {
          expect(element.name).to.eql("person");
          expect(attribute).to.be.undefined;
          expect(prefix).to.be.undefined;
          providerCalled = true;
        }
      ]
    });
    expect(providerCalled).to.be.true;
  });
@bd82
Copy link
Member

bd82 commented Dec 9, 2019

Thanks for providing the example tests, it is probably some offset by 1 logic error 😄

@bd82 bd82 added bug Something isn't working Content Assist labels Dec 9, 2019
@bd82 bd82 self-assigned this Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Content Assist
Projects
None yet
Development

No branches or pull requests

2 participants