This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-editor.git

commit 1d2a45b24eaec6f9f57e49750f16c28963e33258
Author: Sandro Boehme <[email protected]>
AuthorDate: Tue Apr 7 04:21:22 2015 +0000

    reverting "SLING-4555 Resource Editor: fixed e2e tests, node name handling 
in the add node dialog and added an initial version of the add node e2e test" 
as it has been breaking the build.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1671740 
13f79535-47bb-0310-9956-ffa450edef68
---
 README                                             |  7 +--
 frontend/Gruntfile.js                              |  4 +-
 .../js/tree/AddNodeController.js                   | 29 ++++++----
 .../SLING-INF/libs/sling/resource-editor/html.jsp  |  1 -
 src/test/javascript/e2e/spec/e2e_spec.js           | 62 +++-------------------
 5 files changed, 30 insertions(+), 73 deletions(-)

diff --git a/README b/README
index ac4e114..dc9b33c 100644
--- a/README
+++ b/README
@@ -12,13 +12,8 @@ o Use `mvn install sling:install` to deploy changes of Java 
classes
 o To have frontend changes automatically deployed call `mvn install -P 
autoInstallBundle -Dsling.mountByFS=true`
 o To run the build on your local machine call './grunt desktop_build' within 
the frontend directory. It includes end to end tests with firefox and chrome.
 o To have the less sources automatically compiled on change call `./grunt 
watch:less` in the frontend directory. Press Ctrl-Z to stop watching.
-o To have the 'desktop_build' target triggered on changes in the frontend 
tests, less sources, JavaScript files and JSP sources use `./grunt watch:all` 
in the frontend directory and also press Ctrl-Z to stop watching.
-o To get the end to end tests triggered by changes use './grunt watch:e2e' in 
the frontend directory and also press Ctrl-Z to stop watching.
+o To have the 'desktop_build' target triggered on changes in the frontend 
tests, less sources, JavaScript files and JSP sources use call `./grunt 
watch:all` in the frontend directory and also press Ctrl-Z to stop watching. 
 
-++ Debugging the the end to end tests ++
-o You can still use 'console.log()' and JSON.stringify(display) to inspect 
JSON values of a test spec.
-o You can use 'client.pause([milliseconds]);' in you test spec to pause and 
also inspect the browser status.
-o To set breakpoints in a test spec you can use a JavaScript IDE like 
'Webstorm'
 
 
 Enjoy!
\ No newline at end of file
diff --git a/frontend/Gruntfile.js b/frontend/Gruntfile.js
index 0e53f05..7348b0e 100644
--- a/frontend/Gruntfile.js
+++ b/frontend/Gruntfile.js
@@ -57,7 +57,6 @@ module.exports = function(grunt) {
                                  'bootstrap/dist/js/bootstrap.min.js',
                                  'select2/select2.min.js',
                                  'jquery/dist/jquery.min.js',
-                                 'jquery/dist/jquery.min.map',
                                  'bootbox/bootbox.min.js',
                                  'jstree/dist/jstree.min.js'
                                 ], // Actual pattern(s) to match.
@@ -74,7 +73,6 @@ module.exports = function(grunt) {
                    src: [
                          'select2/select2.css',
                          'select2/select2.png',
-                         'select2/select2-spinner.gif',
                          'animate.css/animate.min.css',
                          'jstree/dist/themes/default/style.min.css',
                          'jstree/dist/themes/default/32px.png',
@@ -117,6 +115,8 @@ module.exports = function(grunt) {
            },
         webdriver: {
             options: {
+               host: 'localhost',
+               port: 8080
             },
             chrome: {
                 tests: [e2eTestSpecFolder],
diff --git 
a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js
 
b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js
index 76d8566..e3f510e 100644
--- 
a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js
+++ 
b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/AddNodeController.js
@@ -73,12 +73,12 @@ org.apache.sling.reseditor.AddNodeController = (function() {
                        })
                });
        };
-       
+
        AddNodeController.prototype.addNode = function() {
                var thatAddNodeController = this;
-               var nodeName = this.latestEnteredNodeName;
-               var nodeType = $("#nodeType").select2("val");
-               var resourceType = this.latestEnteredResType;
+               var nodeName = this.latestEnteredNodeName.trim();
+               var nodeType = $("#nodeType").val();
+               var resourceType = (this.latestEnteredResType != null && 
this.latestEnteredResType != "") ? this.latestEnteredResType.trim() : "";
                
                var data = {"_charset_": "utf-8"};
                if ("" != nodeType){
@@ -205,13 +205,19 @@ org.apache.sling.reseditor.AddNodeController = 
(function() {
                $("#nodeName").select2({
                        placeholder: "Enter or select a node name",
                        allowClear: true, 
-                       dropdownCssClass: "node_name_dd_container",
+                       selectOnBlur: true,
                        data: nodeNameObjects,
                        createSearchChoice: function(searchTerm){
-                               thatAddNodeController.latestEnteredNodeName = 
searchTerm;
                                return {id:searchTerm, text:searchTerm};
                        }
                });
+               $("#nodeName").on("select2-highlight", function(e) { 
+                       /* In Select2 there is currently no way of getting
+                        * the highlighted (newly entered but not yet selected) 
text.
+                        * But there is this event. Thats why I use this one. 
+                        */ 
+                       thatAddNodeController.latestEnteredNodeName=e.val;
+               })
                
                var nodeNameList = Object.keys(appliCnTypesByNodeName);
                nodeNameList.sort();
@@ -264,13 +270,16 @@ org.apache.sling.reseditor.AddNodeController = 
(function() {
                                selectOnBlur: true,
                                data: data,
                                createSearchChoice: function(searchTerm){
-                                       
thatAddNodeController.latestEnteredResType = searchTerm;
                                        return {id:searchTerm, text:searchTerm};
                                }
                        }).data("select2");
-                       $("#resourceType").on("select2-loaded", function() {
-                               $('#addNodeDialog').append('<div 
class="add-node-finished"></div>');
-                       });
+                       $("#resourceType").on("select2-highlight", function(e) {
+                               /* In Select2 there is currently no way of 
getting
+                                * the highlighted (newly entered but not yet 
selected) text.
+                                * But there is this event. Thats why I use 
this one. 
+                                */ 
+                               
thatAddNodeController.latestEnteredResType=e.val;
+                       })
                });
        }
        
diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp 
b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
index b1ff7e1..f5ed1d6 100644
--- a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
+++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
@@ -324,6 +324,5 @@ new 
org.apache.sling.reseditor.JSTreeAdapter(jsTreeAdapterSettings, treeControll
            </div>
          </div>
        </div>
-       <div id="last-element"></div>
 </body>
 </html>
diff --git a/src/test/javascript/e2e/spec/e2e_spec.js 
b/src/test/javascript/e2e/spec/e2e_spec.js
index 091bd2b..12b1408 100644
--- a/src/test/javascript/e2e/spec/e2e_spec.js
+++ b/src/test/javascript/e2e/spec/e2e_spec.js
@@ -2,62 +2,16 @@
 
 var assert = require('assert');
 
-describe('A user of the Apache Sling Resource Editor', function() {
-       var homeURL = 'http://localhost:8080/reseditor/.html';
-       var client = browser.url(homeURL);
-       // TODO: Find a way to specify the host and the port via grunt. See 
+describe('The Apache Sling Resource Editor', function() {
+       browser = browser.url('http://localhost:8080/reseditor/.html');
+       // Find a way to specify the host and the port via grunt. See 
        // 
http://stackoverflow.com/questions/29370075/how-to-pass-parameters-from-the-gruntfile-js-to-the-webdriverio-spec
-       client.timeouts("script", 500);
-
-       describe('can open the add node dialog with', function() {
-                 it('the icon', function(done) {
-                         client = client.url(homeURL);
-                         client.waitForExist('#last-element', function(err) {
-                                 client.click('#root_anchor i.add-icon', 
function(err, res) {
-                                         
client.waitForVisible('#addNodeDialog', function(err) {
-                                         
client.getCssProperty('#addNodeDialog', 'display', function(err, display) {
-                                                 assert(typeof err === 
"undefined" || err === null);
-                                                 assert(display.value === 
"block");
-                                         });
-                                 });
-                             })
-                     })
-                     .call(done);
-                 });
-
-                 it('the shortcut', function(done) {
-                         client = client.url(homeURL);
-                         client.waitForExist('#last-element', function(err) {
-                                 client.click('#root_anchor i.add-icon', 
function(err, res) {
-                                         client.keys("a", function(err) {
-                                                 
client.waitForVisible('#addNodeDialog', function(err) {
-                                                 
client.getCssProperty('#addNodeDialog', 'display', function(err, display) {
-                                                         assert(typeof err === 
"undefined" || err === null);
-                                                         assert(display.value 
=== "block");
-                                                 });
-                                         });
-                                         });
-                             })
-                     })
-                     .call(done);
-                 });
-       });
-
-         it('can add an unstructured node to the root node', function(done) {
-                 client = client.url(homeURL);
-                 client.waitForExist('#last-element', function(err) {
-                         client.click('#root_anchor i.add-icon', function(err, 
res) {
-                                 client.waitForVisible('#addNodeDialog 
.add-node-finished', function(err) {
-                                         
client.setValue('.node_name_dd_container input', 'testnode');
-                                         
client.addValue('.node_name_dd_container input', 'Return'); // presses the 
'return' key
-                                         client.click('#addNodeDialog 
.btn.btn-primary.submit', function(err, res) {
-                                                 client.pause(3000); 
-                                         });
-                         });
-                                 
-                     })  
+       
+         it('should have a title', function(done) {
+                 browser
+             .getTitle(function(err,title) {
+                 assert(title.indexOf('Apache Sling Resource Editor') !== -1);
              })
              .call(done);
          });
-       
 });
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to