public void testCreateLexemeProviderMedia() { CSSContentAssistProcessor proc = new CSSContentAssistProcessor(null) { public IRange getLexemeRange(IDocument document, int offset) { return super.getLexemeRange(document, offset); } }; String source = "@media screen, print { body { line-height: 1.2; ; color:#000|; } }"; IFileStore fileStore = createFileStore("proposal_tests", "css", source); this.setupTestContext(fileStore); IRange actualRange = proc.getLexemeRange(document, this.cursorOffsets.get(0)); IRange expectedRange = new Range(0, 64); assertEquals(expectedRange, actualRange); }
public void testCreateLexemeProviderEndingBrace() { CSSContentAssistProcessor proc = new CSSContentAssistProcessor(null) { public IRange getLexemeRange(IDocument document, int offset) { return super.getLexemeRange(document, offset); } }; String source = "body {}|"; IFileStore fileStore = createFileStore("proposal_tests", "css", source); this.setupTestContext(fileStore); IRange actualRange = proc.getLexemeRange(document, this.cursorOffsets.get(0)); IRange expectedRange = new Range(7, 7); assertEquals(expectedRange, actualRange); }
public void testCreateLexemeProvider() { CSSContentAssistProcessor proc = new CSSContentAssistProcessor(null) { public IRange getLexemeRange(IDocument document, int offset) { return super.getLexemeRange(document, offset); } }; String source = "body { font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif; color:#000|; background: none; font-size: 10pt; }"; IFileStore fileStore = createFileStore("proposal_tests", "css", source); this.setupTestContext(fileStore); IRange actualRange = proc.getLexemeRange(document, this.cursorOffsets.get(0)); IRange expectedRange = new Range(0, 115); assertEquals(expectedRange, actualRange); }