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/11/20 19:49:47 UTC
git commit: Update test to account for changes to how initializations,
including field autofocus, operate
Updated Branches:
refs/heads/5.4-js-rewrite 9627613fd -> cd4743dec
Update test to account for changes to how initializations, including field autofocus, operate
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cd4743de
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cd4743de
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cd4743de
Branch: refs/heads/5.4-js-rewrite
Commit: cd4743deccf08b1bf6ac5cf1d171979ee82fca30
Parents: 9627613
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Nov 20 10:49:27 2012 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Nov 20 10:49:27 2012 -0800
----------------------------------------------------------------------
.../ajax/JavaScriptSupportAutofocusTests.groovy | 33 ++++----------
1 files changed, 10 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cd4743de/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
index a979a58..fd4dbee 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportAutofocusTests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2012 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,41 +14,28 @@
package org.apache.tapestry5.internal.services.ajax
-import org.apache.tapestry5.FieldFocusPriority;
-import org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructor;
+import org.apache.tapestry5.FieldFocusPriority
+import org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructor
import org.apache.tapestry5.internal.test.InternalBaseTestCase
-
-import org.apache.tapestry5.services.javascript.InitializationPriority;
-import org.apache.tapestry5.services.javascript.JavaScriptStack
+import org.apache.tapestry5.json.JSONArray
+import org.apache.tapestry5.services.javascript.InitializationPriority
import org.apache.tapestry5.services.javascript.JavaScriptStackSource
-import org.apache.tapestry5.services.javascript.JavaScriptSupport;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport
import org.testng.annotations.Test
-import org.apache.tapestry5.json.JSONArray;
/**
* Tests {@link JavaScriptSupport#autofocus(org.apache.tapestry5.FieldFocusPriority, String)}
*
*/
-class JavaScriptSupportAutofocusTests extends InternalBaseTestCase
-{
+class JavaScriptSupportAutofocusTests extends InternalBaseTestCase {
+
private autofocus_template(expectedFieldId, cls) {
def linker = mockDocumentLinker()
def stackSource = newMock(JavaScriptStackSource.class)
def stackPathConstructor = newMock(JavaScriptStackPathConstructor.class)
- def coreStack = newMock(JavaScriptStack.class)
-
- // Adding the autofocus will drag in the core stack
-
- expect(stackSource.getStack("core")).andReturn coreStack
-
- expect(stackPathConstructor.constructPathsForJavaScriptStack("core")).andReturn([])
-
- expect(coreStack.getStacks()).andReturn([])
- expect(coreStack.getStylesheets()).andReturn([])
- expect(coreStack.getInitialization()).andReturn(null)
- linker.addInitialization(InitializationPriority.NORMAL, "core/init", null,
- new JSONArray("['activate', '$expectedFieldId']"))
+ linker.addInitialization(InitializationPriority.NORMAL, "core/pageinit", "focus",
+ JSONArray.from([expectedFieldId]))
replay()