You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/12/05 23:01:40 UTC

[3/3] git commit: Rename the data-page-loaded attribute to data-page-initialized

Rename the data-page-loaded attribute to data-page-initialized


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/5a920569
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/5a920569
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/5a920569

Branch: refs/heads/5.4-js-rewrite
Commit: 5a920569ec13396d03968432d924854d90085f63
Parents: 455bf0f
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Wed Dec 5 13:19:20 2012 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed Dec 5 13:19:20 2012 -0800

----------------------------------------------------------------------
 54_RELEASE_NOTES.txt                               |    3 +++
 .../META-INF/modules/core/pageinit.coffee          |    3 ++-
 .../tapestry5/integration/app1/AlertsTests.groovy  |    2 +-
 .../integration/app1/CanceledEventTests.groovy     |    4 ++--
 .../integration/app1/FormFieldFocusTest.groovy     |    4 ++--
 .../app1/SubmitUnconditionalTests.groovy           |    4 ++--
 .../tapestry5/integration/app1/TreeTests.groovy    |    4 ++--
 .../integration/app3/PageCatalogTests.groovy       |    2 +-
 .../integration/TapestryCoreTestCase.java          |    8 ++++----
 .../integration/app1/CoreBehaviorsTests.java       |    2 +-
 .../tapestry5/integration/app1/FormTests.java      |    2 +-
 .../tapestry5/integration/app1/PaletteTests.java   |    8 ++++----
 .../tapestry5/integration/app1/ZoneTests.java      |   10 +++++++---
 13 files changed, 32 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/54_RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/54_RELEASE_NOTES.txt b/54_RELEASE_NOTES.txt
index cd773b2..4898277 100644
--- a/54_RELEASE_NOTES.txt
+++ b/54_RELEASE_NOTES.txt
@@ -109,6 +109,9 @@ on the function Tapestry.waitForPage().  Server components no longer make use of
 itself now does nothing. A replacement approach to preventing the user from interacting with links and forms before
 the page initialization has completed may be implemented in the future.
 
+However, once initial page initialization has occurred, the attribute `data-page-initialized` on the root HTML element
+is set to "true".
+
 ## Twitter Bootstrap
 
 Tapestry now includes a default copy of Twitter Bootstrap in addition to its own default set of CSS rules (the

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
index c71c807..5c7a218 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
@@ -158,8 +158,9 @@ define ["_", "core/console", "core/dom", "core/events"],
               # At this point, all libraries have been loaded, and all inits should have executed. Unless some of
               # the inits triggered Ajax updates (such as a core/ProgressiveDisplay component), then the page should
               # be ready to go. We set a flag, mostly used by test suites, to ensure that all is ready.
+              # Note that later Ajax requests do not change this attribute, so their timing continues to be tricky.
 
-              (dom document.documentElement).attribute "data-page-loaded", "true"
+              (dom document.documentElement).attribute "data-page-initialized", "true"
 
       evalJavaScript: (js) ->
         console.debug "Evaluating: #{js}"

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
index f949610..d89bb94 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy
@@ -66,7 +66,7 @@ class AlertsTests extends TapestryCoreTestCase {
         select "css=#ajax select[name=\"duration\"]", "Until Dismissed"
         type "css=#ajax input[name=\"message\"]", "ajax error until"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         click "//input[@value='Ajax Update']"
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy
index 49adef0..0dcd844 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/CanceledEventTests.groovy
@@ -10,7 +10,7 @@ class CanceledEventTests extends TapestryCoreTestCase
     {
         openLinks "Canceled Event Demo"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         clickAndWait SUBMIT
 
@@ -22,7 +22,7 @@ class CanceledEventTests extends TapestryCoreTestCase
     {
         openLinks "Canceled Event Demo"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         clickAndWait "link=Cancel Form"
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormFieldFocusTest.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormFieldFocusTest.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormFieldFocusTest.groovy
index e06aab2..3a103eb 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormFieldFocusTest.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormFieldFocusTest.groovy
@@ -29,7 +29,7 @@ class FormFieldFocusTest extends TapestryCoreTestCase
     {
         openLinks "FormFieldFocus (DEPRECATED) Demo"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         assertEquals getEval("window.document.activeElement.value"), "But I got the focus!"
 
@@ -40,7 +40,7 @@ class FormFieldFocusTest extends TapestryCoreTestCase
     {
         openLinks "OverrideFieldFocus Demo"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         assertEquals getEval("window.document.activeElement.value"), "But I got the focus!"
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/SubmitUnconditionalTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/SubmitUnconditionalTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/SubmitUnconditionalTests.groovy
index 5f6bbaa..085fb7b 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/SubmitUnconditionalTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/SubmitUnconditionalTests.groovy
@@ -10,7 +10,7 @@ class SubmitUnconditionalTests extends TapestryCoreTestCase {
     void submit_with_unconditional_mode() {
         openLinks "Cancel Demo"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         clickAndWait "//input[@value='Abort']"
 
@@ -22,7 +22,7 @@ class SubmitUnconditionalTests extends TapestryCoreTestCase {
 
         openLinks "Cancel Demo"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         clickAndWait "link=Abort"
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/TreeTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/TreeTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/TreeTests.groovy
index 0704f76..e252d86 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/TreeTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/TreeTests.groovy
@@ -28,7 +28,7 @@ class TreeTests extends TapestryCoreTestCase
 
         clickAndWait "link=Clear Expansions"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         //Click on Games
         click "//div[@class='t-tree-container test-hook']/ul/li[2]/span[@class='t-tree-icon']"
@@ -60,7 +60,7 @@ class TreeTests extends TapestryCoreTestCase
 
         clickAndWait "link=Clear All"
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         click "//span[@class='t-tree-icon']"
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
index 7d1dbb5..c53dbbf 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
@@ -15,7 +15,7 @@ class PageCatalogTests extends TapestryCoreTestCase
 
         assertTitle title
 
-        waitForPageLoaded()
+        waitForPageInitialized()
 
         click "link=clear the cache"
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
index 5e08869..18df891 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
@@ -59,16 +59,16 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase
     }
 
     /**
-     * Waits for page initialization to finish, which is recognized by the {@code data-page-loaded} attribute
+     * Waits for page initialization to finish, which is recognized by the {@code data-page-initialized} attribute
      * being added to the HTML element. Polls at 20ms intervals for 200ms.
      *
      * @since 5.4
      */
-    protected final void waitForPageLoaded()
+    protected final void waitForPageInitialized()
     {
         for (int i = 0; i < 10; i++)
         {
-            if (isElementPresent("css=html[data-page-loaded]"))
+            if (isElementPresent("css=html[data-page-initialized]"))
             {
                 return;
             }
@@ -76,6 +76,6 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase
             sleep(20);
         }
 
-        reportAndThrowAssertionError("Page did not finish loading.");
+        reportAndThrowAssertionError("Page did not finish initializing.");
     }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
index 7d4bcea..b6a8786 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
@@ -141,7 +141,7 @@ public class CoreBehaviorsTests extends TapestryCoreTestCase
     {
         openLinks("Expressions in JS Functions Demo");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         click("button1");
         waitForCondition("selenium.getValue('target') == 'test1'", PAGE_LOAD_TIMEOUT);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
index bc6014c..80c68fb 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
@@ -163,7 +163,7 @@ public class FormTests extends TapestryCoreTestCase
 
         clickAndWait("link=Clear Data");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         clickAndWait("//input[@value='Cancel']");
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
index 9d3c642..e9b0889 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
@@ -41,7 +41,7 @@ public class PaletteTests extends TapestryCoreTestCase
     {
         openLinks("Palette Demo", "Reset Page State");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         assertText("css=.t-palette-available .t-palette-title",
                 "Languages Offered");
@@ -56,7 +56,7 @@ public class PaletteTests extends TapestryCoreTestCase
 
         assertTextPresent("Selected Languages: [HASKELL, JAVASCRIPT]");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         addSelection(SELECTED_OPTIONS, "label=Javascript");
 
@@ -81,7 +81,7 @@ public class PaletteTests extends TapestryCoreTestCase
 
         clickAndWait(SUBMIT);
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         addSelection(SELECTED_OPTIONS, "label=Ruby");
 
@@ -126,7 +126,7 @@ public class PaletteTests extends TapestryCoreTestCase
     {
         openLinks("Palette Demo", "Reset Page State");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         click(SUBMIT);
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5a920569/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
index afadbd4..afaeecf 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
@@ -32,7 +32,7 @@ public class ZoneTests extends TapestryCoreTestCase
     {
         openLinks("Select Zone Demo");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         select("carMaker", "Bmw");
 
@@ -184,6 +184,8 @@ public class ZoneTests extends TapestryCoreTestCase
     {
         openLinks("LinkSubmit inside Zone");
 
+        waitForPageInitialized();
+
         String now = getText("now");
 
         waitForElementToAppear("mySubmit");
@@ -300,14 +302,16 @@ public class ZoneTests extends TapestryCoreTestCase
     {
         openLinks("Zone Demo");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         click("link=Select \"CSS Injection\"");
 
-        waitForPageLoaded();
+        waitForPageInitialized();
 
         // First check that the update arrived
 
+        waitForElementToAppear("demo-aip");
+
         assertText("demo-aip", "This should be styled GREEN.");
 
         // Next see if we can verify that the presentation matches the exceptations; greend and underlined.  Underlined from