summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-02-02 06:06:30 +0000
committerwei <>2006-02-02 06:06:30 +0000
commit2037f60c73a77f28cc09fcb64cb424e16c593765 (patch)
treeccc4002a0dc984028e0381f5d4e9342022108075
parenta2a030c3cfbb0249762fffa4159107bc13f8952d (diff)
Fixed #21
-rw-r--r--.gitattributes5
-rw-r--r--framework/Web/Javascripts/js/prado.js59
-rw-r--r--framework/Web/Javascripts/prado/controls.js24
-rw-r--r--tests/FunctionalTests/protected/pages/TicketTestPage.php14
-rw-r--r--tests/FunctionalTests/protected/pages/TicketTestPage.tpl45
-rw-r--r--tests/FunctionalTests/protected/pages/Tickets/Ticket_21.page10
-rw-r--r--tests/FunctionalTests/protected/pages/Tickets/Ticket_21.php37
-rw-r--r--tests/FunctionalTests/protected/pages/Tickets/config.xml5
8 files changed, 172 insertions, 27 deletions
diff --git a/.gitattributes b/.gitattributes
index 3acbd78a..78dcca04 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -713,6 +713,11 @@ tests/FunctionalTests/protected/pages/I18N/BasicI18N.page -text
tests/FunctionalTests/protected/pages/I18N/BasicI18N.php -text
tests/FunctionalTests/protected/pages/Layout.php -text
tests/FunctionalTests/protected/pages/Layout.tpl -text
+tests/FunctionalTests/protected/pages/TicketTestPage.php -text
+tests/FunctionalTests/protected/pages/TicketTestPage.tpl -text
+tests/FunctionalTests/protected/pages/Tickets/Ticket_21.page -text
+tests/FunctionalTests/protected/pages/Tickets/Ticket_21.php -text
+tests/FunctionalTests/protected/pages/Tickets/config.xml -text
tests/FunctionalTests/protected/pages/UI/DatePicker.page -text
tests/FunctionalTests/protected/pages/UI/LabeledTextBox.php -text
tests/FunctionalTests/protected/pages/UI/LabeledTextBox.tpl -text
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js
index dd33345b..657508e6 100644
--- a/framework/Web/Javascripts/js/prado.js
+++ b/framework/Web/Javascripts/js/prado.js
@@ -1862,49 +1862,58 @@ _426=_427;
}
}
if(_426){
-Prado.PostBack(_423,_424);
+this.onPostBack(_423,_424);
}
if(isBoolean(_427)&&!_427){
Event.stop(_423);
}
+},onPostBack:function(_428,_429){
+Prado.PostBack(_428,_429);
}});
Prado.WebUI.TLinkButton=Prado.WebUI.ClickableComponent;
Prado.WebUI.TImageButton=Prado.WebUI.ClickableComponent;
Prado.WebUI.TCheckBox=Prado.WebUI.ClickableComponent;
-Prado.WebUI.TRadioButton=Prado.WebUI.ClickableComponent;
Prado.WebUI.TBulletedList=Prado.WebUI.ClickableComponent;
-Prado.WebUI.TTextBox=Prado.WebUI.createPostBackComponent({onInit:function(_428){
-if(_428["TextMode"]!="MultiLine"){
+Prado.WebUI.TRadioButton=Prado.WebUI.ClickableComponent;
+Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;
+Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(_430){
+this.element=$(_430["ID"]);
+if(!this.element.checked){
+this.onRadioButtonInitialize(_430);
+}
+}});
+Prado.WebUI.TTextBox=Prado.WebUI.createPostBackComponent({onInit:function(_431){
+if(_431["TextMode"]!="MultiLine"){
Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));
}
-Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_428));
+Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_431));
},handleReturnKey:function(e){
if(Event.keyCode(e)==Event.KEY_RETURN){
-var _429=Event.element(e);
-if(_429){
-Event.fireEvent(_429,"change");
+var _432=Event.element(e);
+if(_432){
+Event.fireEvent(_432,"change");
Event.stop(e);
}
}
}});
-Prado.WebUI.TListControl=Prado.WebUI.createPostBackComponent({onInit:function(_430){
-Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_430));
+Prado.WebUI.TListControl=Prado.WebUI.createPostBackComponent({onInit:function(_433){
+Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,_433));
}});
Prado.WebUI.TListBox=Prado.WebUI.TListControl;
Prado.WebUI.TDropDownList=Prado.WebUI.TListControl;
Prado.WebUI.DefaultButton=Class.create();
-Object.extend(Prado.WebUI.DefaultButton.prototype,{initialize:function(_431){
-this.options=_431;
+Object.extend(Prado.WebUI.DefaultButton.prototype,{initialize:function(_434){
+this.options=_434;
this._event=this.triggerEvent.bindEvent(this);
-Event.observe(_431["Panel"],"keydown",this._event);
-},triggerEvent:function(ev,_433){
-var _434=Event.keyCode(ev)==Event.KEY_RETURN;
-var _435=Event.element(ev).tagName.toLowerCase()=="textarea";
-if(_434&&!_435){
-var _436=$(this.options["Target"]);
-if(_436){
+Event.observe(_434["Panel"],"keydown",this._event);
+},triggerEvent:function(ev,_436){
+var _437=Event.keyCode(ev)==Event.KEY_RETURN;
+var _438=Event.element(ev).tagName.toLowerCase()=="textarea";
+if(_437&&!_438){
+var _439=$(this.options["Target"]);
+if(_439){
this.triggered=true;
-Event.fireEvent(_436,this.options["Event"]);
+Event.fireEvent(_439,this.options["Event"]);
Event.stop(ev);
}
}
@@ -1914,15 +1923,15 @@ Prado.WebUI.TTextHighlighter.prototype={initialize:function(id){
if(!window.clipboardData){
return;
}
-var _437={href:"javascript:;//copy code to clipboard",onclick:"Prado.WebUI.TTextHighlighter.copy(this)",onmouseover:"Prado.WebUI.TTextHighlighter.hover(this)",onmouseout:"Prado.WebUI.TTextHighlighter.out(this)"};
-var div=DIV({className:"copycode"},A(_437,"Copy Code"));
+var _440={href:"javascript:;//copy code to clipboard",onclick:"Prado.WebUI.TTextHighlighter.copy(this)",onmouseover:"Prado.WebUI.TTextHighlighter.hover(this)",onmouseout:"Prado.WebUI.TTextHighlighter.out(this)"};
+var div=DIV({className:"copycode"},A(_440,"Copy Code"));
document.write(DIV(null,div).innerHTML);
}};
Object.extend(Prado.WebUI.TTextHighlighter,{copy:function(obj){
-var _438=obj.parentNode.parentNode.parentNode;
+var _441=obj.parentNode.parentNode.parentNode;
var text="";
-for(var i=0;i<_438.childNodes.length;i++){
-var node=_438.childNodes[i];
+for(var i=0;i<_441.childNodes.length;i++){
+var node=_441.childNodes[i];
if(node.innerText){
text+=node.innerText=="Copy Code"?"":node.innerText;
}else{
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js
index c472c1be..d059b4a5 100644
--- a/framework/Web/Javascripts/prado/controls.js
+++ b/framework/Web/Javascripts/prado/controls.js
@@ -56,18 +56,38 @@ Prado.WebUI.ClickableComponent = Prado.WebUI.createPostBackComponent(
doPostBack = onclicked;
}
if(doPostBack)
- Prado.PostBack(event,options);
+ this.onPostBack(event,options);
if(isBoolean(onclicked) && !onclicked)
Event.stop(event);
+ },
+
+ onPostBack : function(event, options)
+ {
+ Prado.PostBack(event,options);
}
});
Prado.WebUI.TLinkButton = Prado.WebUI.ClickableComponent;
Prado.WebUI.TImageButton = Prado.WebUI.ClickableComponent;
Prado.WebUI.TCheckBox = Prado.WebUI.ClickableComponent;
-Prado.WebUI.TRadioButton = Prado.WebUI.ClickableComponent;
Prado.WebUI.TBulletedList = Prado.WebUI.ClickableComponent;
+/**
+ * Radio button, only initialize if not already checked.
+ */
+Prado.WebUI.TRadioButton = Prado.WebUI.ClickableComponent;
+Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize = Prado.WebUI.TRadioButton.prototype.initialize;
+Object.extend(Prado.WebUI.TRadioButton.prototype,
+{
+ initialize : function(options)
+ {
+ this.element = $(options['ID']);
+ if(!this.element.checked)
+ this.onRadioButtonInitialize(options);
+ }
+});
+
+
Prado.WebUI.TTextBox = Prado.WebUI.createPostBackComponent(
{
onInit : function(options)
diff --git a/tests/FunctionalTests/protected/pages/TicketTestPage.php b/tests/FunctionalTests/protected/pages/TicketTestPage.php
new file mode 100644
index 00000000..f647f56b
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/TicketTestPage.php
@@ -0,0 +1,14 @@
+<?php
+
+class TicketTestPage extends TTemplateControl
+{
+ public function onLoad($param)
+ {
+ $num = str_replace('Ticket_','',get_class($this->getPage()));
+ $this->getPage()->setTitle("Verifying Ticket $num");
+ $this->ticketlink->setText("Verifying Ticket $num");
+ $this->ticketlink->setNavigateUrl("http://trac.pradosoft.com/ticket/{$num}");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/TicketTestPage.tpl b/tests/FunctionalTests/protected/pages/TicketTestPage.tpl
new file mode 100644
index 00000000..bf2f8fab
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/TicketTestPage.tpl
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<com:THead Title="PRADO Functional Tests">
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+ <style type="text/css">
+ /*<![CDATA[*/
+ .defect
+ {
+ color: #c00;
+ font-size: 1.15em;
+ }
+ body
+ {
+ font-family: Georgia, "Times New Roman", Times, serif;
+ }
+ .w3c
+ {
+ margin-top: 2em;
+ display: block;
+ }
+ /*]]>*/
+ </style>
+</com:THead>
+<body>
+<com:TForm>
+<h1><com:THyperLink ID="ticketlink" /></h1>
+
+<com:TContentPlaceHolder ID="Content" />
+<hr style="margin-top: 2em" />
+<com:TJavascriptLogger />
+</com:TForm>
+<div class="w3c">
+<a href="http://validator.w3.org/check?uri=referer">
+ Validate XHTML 1.0
+</a>
+<a href="?page=ViewSource&amp;path=<%= str_replace('.','/', $this->Request->ServiceParameter) %>.page"
+ style="margin: 0 1em;"
+ onclick="window.open(this.href); return false;"
+ onkeypress="window.open(this.href); return false;">View Source</a>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/Tickets/Ticket_21.page b/tests/FunctionalTests/protected/pages/Tickets/Ticket_21.page
new file mode 100644
index 00000000..e0619ea1
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/Tickets/Ticket_21.page
@@ -0,0 +1,10 @@
+<com:TContent ID="Content">
+<h2 class="defect">TRadioButton always postback if AutoPostBack=true</h2>
+
+<com:TRadioButton ID="button1"
+ AutoPostBack="true"
+ OnCheckedChanged="doClick" />
+<com:TLabel ForControl="button1" Text="radio button 1" /> <br>
+
+<com:TLabel ID="label1" />
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/Tickets/Ticket_21.php b/tests/FunctionalTests/protected/pages/Tickets/Ticket_21.php
new file mode 100644
index 00000000..7a9e3519
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/Tickets/Ticket_21.php
@@ -0,0 +1,37 @@
+<?php
+
+class Ticket_21 extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+
+ if(!$this->IsPostBack)
+ $this->setViewState("clicks", 0);
+ }
+
+ public function doClick($sender, $param)
+ {
+ $clicks = $this->getViewState("clicks");
+ $clicks++;
+ $this->label1->setText("Radio button clicks: $clicks");
+ $this->setViewState("clicks", $clicks);
+ }
+}
+
+class Ticket_21_TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open(Prado::getApplication()->getTestPage(__FILE__));
+ $this->assertTitle("Verifying Ticket 21");
+ $this->clickAndWait("ctl0_Content_button1");
+ $this->verifyTextPresent("Radio button clicks: 1", "");
+ $this->click("ctl0_Content_button1");
+ $this->verifyTextPresent("Radio button clicks: 1", "");
+
+ }
+}
+
+?>
+
diff --git a/tests/FunctionalTests/protected/pages/Tickets/config.xml b/tests/FunctionalTests/protected/pages/Tickets/config.xml
new file mode 100644
index 00000000..8e9db49e
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/Tickets/config.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <pages MasterClass="Pages.TicketTestPage" />
+</configuration> \ No newline at end of file