1. netbeans
  2. main-silver

Commits

Marek Fukala  committed 072a24c Merge

Automated merge with http://hg.netbeans.org/web-main

  • Participants
  • Parent commits bab3bc3, c3f205c
  • Branches default

Comments (0)

Files changed (2)

File html.editor/test/unit/src/org/netbeans/modules/html/editor/completion/HtmlCompletionQueryTest.java

View file
 
         //complete in folder
         code = "<a href='folder1/|'";
-        //             01234567890
+        //      012345678901234567
         //we need a fileobject backed document here
         doc = createDocuments("test.html", "folder1/another.html", "images/image.png")[0]; //use test.html
         doc.insertString(0, code, null);
-        assertItems(doc, arr("another.html"), Match.CONTAINS, 9);
+        assertItems(doc, arr("../", "another.html"), Match.CONTAINS, 9);
+
+        //complete go up in nested folders
+        code = "<a href='folder1/folder2/|'";
+        //      01234567890123456789023456
+        //we need a fileobject backed document here
+        doc = createDocuments("test.html", "folder1/folder2/another.html")[0]; //use test.html
+        doc.insertString(0, code, null);
+        assertItems(doc, arr("../", "another.html"), Match.CONTAINS, 9);
+        
     }
 
     public void testFileAttrValueWithPrefix() throws BadLocationException, ParseException {
         doc = createDocuments("test.html", "another.html", "image.png")[0]; //use test.html
         doc.insertString(0, code, null);
         assertItems(doc, arr("image.png"), Match.CONTAINS, 8);
+
+        //complete go up in nested folders
+        code = "<a href='folder1/folder2/.|'";
+        //      01234567890123456789023456
+        //we need a fileobject backed document here
+        doc = createDocuments("test.html", "folder1/folder2/another.html")[0]; //use test.html
+        doc.insertString(0, code, null);
+        assertItems(doc, arr("../"), Match.CONTAINS, 9);
+
+        //complete go up in nested folders
+        code = "<a href='folder1/folder2/..|'";
+        //      01234567890123456789023456
+        //we need a fileobject backed document here
+        doc = createDocuments("test.html", "folder1/folder2/another.html")[0]; //use test.html
+        doc.insertString(0, code, null);
+        assertItems(doc, arr("../"), Match.CONTAINS, 9);
     }
 
     public void testFileAttrValueUppercase() throws BadLocationException, ParseException {

File web.common/src/org/netbeans/modules/web/common/api/FileReferenceCompletion.java

View file
 
                 //add go up in the directories structure item
                 if (!(documentBase != null && folder.equals(documentBase)) && !path.startsWith("/") // NOI18N
-                        && (path.length() == 0 || (path.lastIndexOf("../") + 3 == path.length()))) { // NOI18N
-//                        result.add(HtmlCompletionItem.createGoUpFileCompletionItem(anchor, java.awt.Color.BLUE, PACKAGE_ICON)); // NOI18N
+                        && (fileNamePart.isEmpty() // ../| case
+                        ||
+                        fileNamePart.equals(".") // ../.| case
+                        ||
+                        fileNamePart.equals("..")) //../..| case
+                        ) { // NOI18N
                     result.add(createGoUpItem(anchor, Color.BLUE, PACKAGE_ICON)); // NOI18N
                 }
             }