public void testNgSrcCompletion() { myFixture.configureByFiles("ng-src.completion.html", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("img ng-<caret>", myFixture.getFile()); myFixture.getEditor().getCaretModel().moveToOffset(offsetBySignature); myFixture.completeBasic(); assertContainsElements(myFixture.getLookupElementStrings(), "ng-src"); offsetBySignature = AngularTestUtil.findOffsetBySignature("div ng-<caret>", myFixture.getFile()); myFixture.getEditor().getCaretModel().moveToOffset(offsetBySignature); myFixture.completeBasic(); assertDoesntContain(myFixture.getLookupElementStrings(), "ng-src"); }
public void testRestrictE() { myFixture.configureByFiles("form.html", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("div f<caret>", myFixture.getFile()); myFixture.getEditor().getCaretModel().moveToOffset(offsetBySignature); myFixture.completeBasic(); assertDoesntContain(myFixture.getLookupElementStrings(), "form"); }
public void testRepeatCompletion() { myFixture.configureByFiles("ng-repeat.html", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("<div ng-rep<caret>", myFixture.getFile()); myFixture.getEditor().getCaretModel().moveToOffset(offsetBySignature); myFixture.completeBasic(); assertContainsElements( myFixture.getLookupElementStrings(), "ng-repeat", "ng-repeat-start", "ng-repeat-end"); }
public void testStandardAttributesDataResolve() { myFixture.configureByFiles("standard-data.after.html", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("ng-mo<caret>del", myFixture.getFile()); PsiReference ref = myFixture.getFile().findReferenceAt(offsetBySignature); assertNotNull(ref); PsiElement resolve = ref.resolve(); assertNotNull(resolve); assertEquals("angular.js", resolve.getContainingFile().getName()); }
public void testElement() { myFixture.configureByFiles("ng-copy.html", "angular.js"); for (String signature : new String[] {"input", "select", "textarea", "a"}) { int offsetBySignature = AngularTestUtil.findOffsetBySignature( "<" + signature + " ng-<caret>", myFixture.getFile()); myFixture.getEditor().getCaretModel().moveToOffset(offsetBySignature); myFixture.completeBasic(); assertContainsElements(myFixture.getLookupElementStrings(), "ng-copy"); } }
public void testCustomAttributesInDirectiveEmptyResolve() { myFixture.configureByFiles("customInDirectiveEmpty.after.html", "custom.js", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("my-cus<caret>tomer", myFixture.getFile()); PsiReference ref = myFixture.getFile().findReferenceAt(offsetBySignature); assertNotNull(ref); PsiElement resolve = ref.resolve(); assertNotNull(resolve); assertEquals("custom.js", resolve.getContainingFile().getName()); assertEquals( "'myCustomer'", ((JSOffsetBasedImplicitElement) resolve).getElementAtOffset().getText()); }
public void testRepeatResolve() { myFixture.configureByFiles("ng-repeat.resolve.html", "angular.js"); for (String suffix : new String[] {"", "-start", "-end"}) { int offsetBySignature = AngularTestUtil.findOffsetBySignature("ng<caret>-repeat" + suffix, myFixture.getFile()); PsiReference ref = myFixture.getFile().findReferenceAt(offsetBySignature); assertNotNull(ref); PsiElement resolve = ref.resolve(); assertNotNull(resolve); assertEquals("angular.js", resolve.getContainingFile().getName()); } }
public void testAppResolve() { myFixture.configureByFiles("app.after.html", "custom.js", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("docs<caret>SimpleDirective", myFixture.getFile()); PsiReference ref = myFixture.getFile().findReferenceAt(offsetBySignature); assertNotNull(ref); PsiElement resolve = ref.resolve(); assertNotNull(resolve); assertEquals("custom.js", resolve.getContainingFile().getName()); assertEquals( "'docsSimpleDirective'", ((JSOffsetBasedImplicitElement) resolve).getElementAtOffset().getText()); }
public void testPrefixedControllerResolve() { myFixture.configureByFiles("controller.prefixed.html", "custom.js", "angular.js"); int offsetBySignature = AngularTestUtil.findOffsetBySignature("Supa<caret>Controller", myFixture.getFile()); PsiReference ref = myFixture.getFile().findReferenceAt(offsetBySignature); assertNotNull(ref); PsiElement resolve = ref.resolve(); assertNotNull(resolve); assertEquals("custom.js", resolve.getContainingFile().getName()); assertEquals( "'SupaController'", ((JSOffsetBasedImplicitElement) resolve).getElementAtOffset().getText()); }