diff options
author | wei <> | 2006-10-01 10:37:06 +0000 |
---|---|---|
committer | wei <> | 2006-10-01 10:37:06 +0000 |
commit | 9fee2935d91e92235b068632d3608c748ef41bfe (patch) | |
tree | 4e05ba6e0fb298ef7c935c3e0082409cec766fd8 | |
parent | 36f2ce766bde98c11d57b889fd9e1a7f8dff6010 (diff) |
fix image button, update functional test cases for opera
14 files changed, 162 insertions, 129 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index e620399f..4c3a8146 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -211,28 +211,28 @@ if(this.saving)return;this.effect=new Effect.Highlight(this.element,{startcolor: this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode();},onComplete:function(transport){this.leaveEditMode();this.options.onComplete.bind(this)(transport,this.element);},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;} this.leaveEditMode();Event.stopObserving(this.element,'click',this.onclickListener);Event.stopObserving(this.element,'mouseover',this.mouseoverListener);Event.stopObserving(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,'click',this.onclickListener);Event.stopObserving(this.options.externalControl,'mouseover',this.mouseoverListener);Event.stopObserving(this.options.externalControl,'mouseout',this.mouseoutListener);}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var selectTag=document.createElement("select");var collection=this.options.collection||[];var optionTag;collection.each(function(e,i){optionTag=document.createElement("option");optionTag.value=(e instanceof Array)?e[0]:e;if(this.options.value==optionTag.value)optionTag.selected=true;optionTag.appendChild(document.createTextNode((e instanceof Array)?e[1]:e));selectTag.appendChild(optionTag);}.bind(this));this.cached_selectTag=selectTag;} this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExternalText();this.form.appendChild(this.editField);this.options.callback=function(form,value){return"value="+encodeURIComponent(value);}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}};Prado.WebUI.CallbackControl=Class.extend(Prado.WebUI.PostBackControl,{onPostBack:function(event,options) -{request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options) -{this.addXYInput(event,options);request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options) -{request=new Prado.CallbackRequest(options.EventTarget,options);if(request.dispatch()==false) +{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options) +{this.addXYInput(event,options);var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options) +{var request=new Prado.CallbackRequest(options.EventTarget,options);if(request.dispatch()==false) Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveCheckBoxList=Base.extend({constructor:function(options) {for(var i=0;i<options.ItemCount;i++) {var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TActiveCheckBox(checkBoxOptions);}}});Prado.WebUI.TActiveRadioButtonList=Prado.WebUI.TActiveCheckBoxList;Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options) {if(options['TextMode']!='MultiLine') Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));Event.observe(this.element,"change",this.doCallback.bindEvent(this,options));},doCallback:function(event,options) -{request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options) +{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options) {this.options=options;this.baseInitialize(options.ID,options.ResultPanel,options);Object.extend(this.options,{onSuccess:this.onComplete.bind(this)});if(options.AutoPostBack) this.onInit(options);},doCallback:function(event,options) {if(!this.active) -{request=new Prado.CallbackRequest(this.options.EventTarget,options);request.dispatch();Event.stop(event);}},onClick:function(event) +{var request=new Prado.CallbackRequest(this.options.EventTarget,options);request.dispatch();Event.stop(event);}},onClick:function(event) {var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();Event.fireEvent(this.element,"change");},getUpdatedChoices:function() -{options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},onComplete:function(request,boundary) -{result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string"&&result.length>0) +{var options=new Array(this.getToken(),"__TAutoComplete_onSuggest__");Prado.Callback(this.options.EventTarget,options,null,this.options);},onComplete:function(request,boundary) +{var result=Prado.Element.extractContent(request.transport.responseText,boundary);if(typeof(result)=="string"&&result.length>0) this.updateChoices(result);}});Prado.WebUI.TTimeTriggeredCallback=Base.extend({count:0,timeout:0,constructor:function(options) {this.options=Object.extend({Interval:1,DecayRate:0},options||{}) this.onComplete=this.options.onComplete;Prado.WebUI.TTimeTriggeredCallback.register(this);},startTimer:function() {this.options.onComplete=this.onRequestComplete.bind(this);this.timer=setTimeout(this.onTimerEvent.bind(this),200);},stopTimer:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.options.onComplete=undefined;clearTimeout(this.timer);this.timer=undefined;this.count=0;},onTimerEvent:function() -{this.options.params=this.timeout/1000;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();},onRequestComplete:function() +{this.options.params=this.timeout/1000;var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();},onRequestComplete:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.timer=setTimeout(this.onTimerEvent.bind(this),this.getNewTimeout())},getNewTimeout:function() {switch(this.options.DecayType) {case'Exponential':t=(Math.exp(this.options.DecayRate*this.count*this.options.Interval))-1;break;case'Linear':t=this.options.DecayRate*this.count*this.options.Interval;break;case'Quadratic':t=this.options.DecayRate*this.count*this.count*this.options.Interval;break;case'Cubic':t=this.options.DecayRate*this.count*this.count*this.count*this.options.Interval;break;default:t=0;} @@ -241,25 +241,25 @@ this.timeout=(t+this.options.Interval)*1000;this.count++;return parseInt(this.ti {Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();},stop:function(id) {Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) {this.element=$(options.ID);this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));},doCallback:function(event) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) -{this.options=options;element=$(options['ControlID']);if(element) +{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) +{this.options=options;var element=$(options['ControlID']);if(element) Event.observe(element,this.getEventName(element),this.doCallback.bind(this));},getEventName:function(element) -{name=this.options.EventName;if(typeof(name)=="undefined"&&element.type) +{var name=this.options.EventName;if(typeof(name)=="undefined"&&element.type) {switch(element.type.toLowerCase()) {case'password':case'text':case'textarea':case'select-one':case'select-multiple':return'change';}} return typeof(name)=="undefined"||name=="undefined"?'click':name;},doCallback:function(event) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();if(this.options.StopEvent==true) +{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();if(this.options.StopEvent==true) Event.stop(event);}});Prado.WebUI.TValueTriggeredCallback=Base.extend({count:1,observing:true,constructor:function(options) -{this.options=options;this.options.PropertyName=this.options.PropertyName||'value';element=$(options['ControlID']);this.value=element?element[this.options.PropertyName]:undefined;Prado.WebUI.TValueTriggeredCallback.register(this);this.startObserving();},stopObserving:function() +{this.options=options;this.options.PropertyName=this.options.PropertyName||'value';var element=$(options['ControlID']);this.value=element?element[this.options.PropertyName]:undefined;Prado.WebUI.TValueTriggeredCallback.register(this);this.startObserving();},stopObserving:function() {clearTimeout(this.timer);this.observing=false;},startObserving:function() {this.timer=setTimeout(this.checkChanges.bind(this),this.options.Interval*1000);},checkChanges:function() -{element=$(this.options.ControlID);if(element) -{value=element[this.options.PropertyName];if(this.value!=value) +{var element=$(this.options.ControlID);if(element) +{var value=element[this.options.PropertyName];if(this.value!=value) {this.doCallback(this.value,value);this.value=value;this.count=1;} else this.count=this.count+this.options.Decay;if(this.observing) this.time=setTimeout(this.checkChanges.bind(this),parseInt(this.options.Interval*1000*this.count));}},doCallback:function(oldValue,newValue) -{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer) +{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);var param={'OldValue':oldValue,'NewValue':newValue};request.setCallbackParameter(param);request.dispatch();}},{timers:{},register:function(timer) {Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID]=timer;},stop:function(id) {Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) {this.options=Object.extend({LoadTextFromSource:false,TextMode:'SingleLine'},options||{});this.element=$(this.options.ID);this.initializeListeners();},initializeListeners:function() diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js index dc35043d..77df7bc2 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2021,7 +2021,7 @@ Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl, {
onPostBack : function(event, options)
{
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -2041,7 +2041,7 @@ Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton, onPostBack : function(event, options)
{
this.addXYInput(event,options);
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -2053,7 +2053,7 @@ Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, {
onPostBack : function(event, options)
{
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
if(request.dispatch()==false)
Event.stop(event);
}
@@ -2097,7 +2097,7 @@ Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox, doCallback : function(event, options)
{
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -2126,7 +2126,7 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, {
if(!this.active)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -2144,13 +2144,13 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, getUpdatedChoices : function()
{
- options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
+ var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
Prado.Callback(this.options.EventTarget, options, null, this.options);
},
onComplete : function(request, boundary)
{
- result = Prado.Element.extractContent(request.transport.responseText, boundary);
+ var result = Prado.Element.extractContent(request.transport.responseText, boundary);
if(typeof(result) == "string" && result.length > 0)
this.updateChoices(result);
}
@@ -2194,7 +2194,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( onTimerEvent : function()
{
this.options.params = this.timeout/1000;
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
},
@@ -2258,7 +2258,7 @@ Prado.WebUI.ActiveListControl = Base.extend( doCallback : function(event)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
Event.stop(event);
}
@@ -2275,14 +2275,14 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( constructor : function(options)
{
this.options = options;
- element = $(options['ControlID']);
+ var element = $(options['ControlID']);
if(element)
Event.observe(element, this.getEventName(element), this.doCallback.bind(this));
},
getEventName : function(element)
{
- name = this.options.EventName;
+ var name = this.options.EventName;
if(typeof(name) == "undefined" && element.type)
{
switch (element.type.toLowerCase())
@@ -2300,7 +2300,7 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( doCallback : function(event)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
if(this.options.StopEvent == true)
Event.stop(event);
@@ -2320,7 +2320,7 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( {
this.options = options;
this.options.PropertyName = this.options.PropertyName || 'value';
- element = $(options['ControlID']);
+ var element = $(options['ControlID']);
this.value = element ? element[this.options.PropertyName] : undefined;
Prado.WebUI.TValueTriggeredCallback.register(this);
this.startObserving();
@@ -2339,10 +2339,10 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( checkChanges : function()
{
- element = $(this.options.ControlID);
+ var element = $(this.options.ControlID);
if(element)
{
- value = element[this.options.PropertyName];
+ var value = element[this.options.PropertyName];
if(this.value != value)
{
this.doCallback(this.value, value);
@@ -2359,8 +2359,8 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( doCallback : function(oldValue, newValue)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
- param = {'OldValue' : oldValue, 'NewValue' : newValue};
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var param = {'OldValue' : oldValue, 'NewValue' : newValue};
request.setCallbackParameter(param);
request.dispatch();
}
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index a455a0dd..920c2150 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -3252,39 +3252,6 @@ Prado.Element.Insert = Prado.WebUI = Class.create();
-//base postback-able controls
-/*Prado.WebUI.PostBackControl = Class.create();
-Prado.WebUI.PostBackControl.prototype =
-{
- initialize : function(options)
- {
- this.element = $(options['ID']);
-
-/* if(options.CausesValidation && typeof(Prado.Validation) != 'undefined')
- {
- Prado.Validation.registerTarget(options);
- }
-
- //TODO: what do the following options do?
- //options['PostBackUrl']
- //options['ClientSubmit']
-
- if(this.onInit)
- this.onInit(options);
- }
-};
-
-//short cut to create postback components
-Prado.WebUI.createPostBackComponent = function(definition)
-{
- var component = Class.create();
- Object.extend(component.prototype, Prado.WebUI.PostBackControl.prototype);
- if(definition) Object.extend(component.prototype, definition);
- return component;
-}
-
-Prado.WebUI.TButton = Prado.WebUI.createPostBackComponent();
-*/
Prado.WebUI.PostBackControl = Class.create();
Prado.WebUI.PostBackControl.prototype =
diff --git a/framework/Web/Javascripts/prado/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols3.js index 68ea3cf3..cb787571 100644 --- a/framework/Web/Javascripts/prado/activecontrols3.js +++ b/framework/Web/Javascripts/prado/activecontrols3.js @@ -5,7 +5,7 @@ Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl, {
onPostBack : function(event, options)
{
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -25,7 +25,7 @@ Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton, onPostBack : function(event, options)
{
this.addXYInput(event,options);
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -37,7 +37,7 @@ Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, {
onPostBack : function(event, options)
{
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
if(request.dispatch()==false)
Event.stop(event);
}
@@ -81,7 +81,7 @@ Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox, doCallback : function(event, options)
{
- request = new Prado.CallbackRequest(options.EventTarget, options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -110,7 +110,7 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, {
if(!this.active)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, options);
request.dispatch();
Event.stop(event);
}
@@ -128,13 +128,13 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, getUpdatedChoices : function()
{
- options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
+ var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
Prado.Callback(this.options.EventTarget, options, null, this.options);
},
onComplete : function(request, boundary)
{
- result = Prado.Element.extractContent(request.transport.responseText, boundary);
+ var result = Prado.Element.extractContent(request.transport.responseText, boundary);
if(typeof(result) == "string" && result.length > 0)
this.updateChoices(result);
}
@@ -178,7 +178,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( onTimerEvent : function()
{
this.options.params = this.timeout/1000;
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
},
@@ -242,7 +242,7 @@ Prado.WebUI.ActiveListControl = Base.extend( doCallback : function(event)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
Event.stop(event);
}
@@ -259,14 +259,14 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( constructor : function(options)
{
this.options = options;
- element = $(options['ControlID']);
+ var element = $(options['ControlID']);
if(element)
Event.observe(element, this.getEventName(element), this.doCallback.bind(this));
},
getEventName : function(element)
{
- name = this.options.EventName;
+ var name = this.options.EventName;
if(typeof(name) == "undefined" && element.type)
{
switch (element.type.toLowerCase())
@@ -284,7 +284,7 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( doCallback : function(event)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
if(this.options.StopEvent == true)
Event.stop(event);
@@ -304,7 +304,7 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( {
this.options = options;
this.options.PropertyName = this.options.PropertyName || 'value';
- element = $(options['ControlID']);
+ var element = $(options['ControlID']);
this.value = element ? element[this.options.PropertyName] : undefined;
Prado.WebUI.TValueTriggeredCallback.register(this);
this.startObserving();
@@ -323,10 +323,10 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( checkChanges : function()
{
- element = $(this.options.ControlID);
+ var element = $(this.options.ControlID);
if(element)
{
- value = element[this.options.PropertyName];
+ var value = element[this.options.PropertyName];
if(this.value != value)
{
this.doCallback(this.value, value);
@@ -343,8 +343,8 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( doCallback : function(oldValue, newValue)
{
- request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
- param = {'OldValue' : oldValue, 'NewValue' : newValue};
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var param = {'OldValue' : oldValue, 'NewValue' : newValue};
request.setCallbackParameter(param);
request.dispatch();
}
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js index 76ff828c..0f1bb4d4 100644 --- a/framework/Web/Javascripts/prado/controls.js +++ b/framework/Web/Javascripts/prado/controls.js @@ -1,38 +1,5 @@ Prado.WebUI = Class.create();
-//base postback-able controls
-/*Prado.WebUI.PostBackControl = Class.create();
-Prado.WebUI.PostBackControl.prototype =
-{
- initialize : function(options)
- {
- this.element = $(options['ID']);
-
-/* if(options.CausesValidation && typeof(Prado.Validation) != 'undefined')
- {
- Prado.Validation.registerTarget(options);
- }
-
- //TODO: what do the following options do?
- //options['PostBackUrl']
- //options['ClientSubmit']
-
- if(this.onInit)
- this.onInit(options);
- }
-};
-
-//short cut to create postback components
-Prado.WebUI.createPostBackComponent = function(definition)
-{
- var component = Class.create();
- Object.extend(component.prototype, Prado.WebUI.PostBackControl.prototype);
- if(definition) Object.extend(component.prototype, definition);
- return component;
-}
-
-Prado.WebUI.TButton = Prado.WebUI.createPostBackComponent();
-*/
Prado.WebUI.PostBackControl = Class.create();
Prado.WebUI.PostBackControl.prototype =
diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php index 3e96abdc..8a6f615b 100644 --- a/framework/Web/UI/WebControls/TImageButton.php +++ b/framework/Web/UI/WebControls/TImageButton.php @@ -103,11 +103,10 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven $writer->addAttribute('type','image');
if(($uniqueID=$this->getUniqueID())!=='')
$writer->addAttribute('name',$uniqueID);
- if($this->getEnabled(true)
- && $this-canCauseValidation()
- && $this->getEnableClientScript())
+ if($this->getEnabled(true))
{
- $this->renderClientControlScript($writer);
+ if($this->canCauseValidation() && $this->getEnableClientScript())
+ $this->renderClientControlScript($writer);
}
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
$writer->addAttribute('disabled','disabled');
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php index a66cf853..03081f9e 100644 --- a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php @@ -4,6 +4,9 @@ class ActiveCheckBoxListTestCase extends SeleniumTestCase { function test() { + //problem with test runner clicking on radio buttons + $this->skipBrowsers(self::OPERA); + $this->open("active-controls/index.php?page=TActiveCheckBoxListTest"); $this->verifyTextPresent("TActiveCheckBoxList Test Case"); diff --git a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php index 6bf00f05..ce2ce430 100644 --- a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxTestCase.php @@ -4,6 +4,9 @@ class ActiveCheckBoxTestCase extends SeleniumTestCase { function test() { + //problem with test runner clicking on checkboxes + $this->skipBrowsers(self::OPERA); + $this->open("active-controls/index.php?page=ActiveCheckBoxTest"); $this->verifyTextPresent("Active CheckBox Test"); diff --git a/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php index 3d9937bd..d497e915 100644 --- a/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php @@ -10,7 +10,7 @@ class ActiveImageButtonTestCase extends SeleniumTestCase $this->click("image1");
$this->pause(800);
//unable to determine mouse position
- $this->assertTextPresent("Image clicked at x=0, y=0");
+ $this->assertTextPresent("regexp:Image clicked at x=\d+, y=\d+");
}
}
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php index 386caa55..ce269cd1 100644 --- a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php @@ -4,6 +4,9 @@ class ActiveRadioButtonListTestCase extends SeleniumTestCase {
function test()
{
+ //problem with test runner clicking on radio buttons
+ $this->skipBrowsers(self::OPERA);
+
$this->open("active-controls/index.php?page=ActiveRadioButtonListTest");
$this->verifyTextPresent("TActiveRadioButtonList Test Case");
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php index c21426cb..46925960 100644 --- a/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonTestCase.php @@ -4,6 +4,9 @@ class ActiveRadioButtonTestCase extends SeleniumTestCase {
function test()
{
+ //problem with test runner clicking on radio buttons
+ $this->skipBrowsers(self::OPERA);
+
$this->open("active-controls/index.php?page=ActiveRadioButtonTest");
$this->verifyTextPresent("Active Radio Button Test");
$this->assertText('label1', 'Label 1');
diff --git a/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php b/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php index e49eb513..c733a7fd 100644 --- a/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/CallbackAdapterTestCase.php @@ -4,6 +4,8 @@ class CallbackAdapterTestCase extends SeleniumTestCase { function test() { + $this->skipBrowsers(self::INTERNET_EXPLORER); + $this->open("active-controls/index.php?page=ControlAdapterTest"); $this->assertTextPresent('Control Adapter - State Tracking Tests'); @@ -27,6 +29,34 @@ class CallbackAdapterTestCase extends SeleniumTestCase $this->assertAlert('baz!'); } + + function testIE() + { + $this->targetBrowsers(self::INTERNET_EXPLORER); + + $this->open("active-controls/index.php?page=ControlAdapterTest"); + $this->assertTextPresent('Control Adapter - State Tracking Tests'); + + $this->click('button2'); + $this->assertAlert('ok'); + + $this->click('test6'); + $this->pause(800); + $this->click('test7'); + $this->pause(800); + $this->click('test8'); + $this->pause(800); + $this->click('test9'); + $this->pause(800); + + $this->click('button1'); + $this->assertAlert('haha!'); + + //IE alerts in diffrent order + $this->click('button2'); + $this->assertAlert('baz!'); + $this->assertAlert('ok'); + } } ?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php index be0d0645..b90607e6 100644 --- a/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php @@ -4,6 +4,8 @@ class ReplaceContentTestCase extends SeleniumTestCase {
function test()
{
+ $this->skipBrowsers(self::INTERNET_EXPLORER);
+
$this->open('active-controls/index.php?page=ReplaceContentTest');
$this->assertTextPresent('Callback Replace Content Test');
@@ -43,6 +45,51 @@ class ReplaceContentTestCase extends SeleniumTestCase $this->assertText('panel1', 'Main Panel pradomauahahahaphp');
}
+
+ function testIE()
+ {
+ $this->targetBrowsers(self::INTERNET_EXPLORER);
+
+ $this->open('active-controls/index.php?page=ReplaceContentTest');
+ $this->assertTextPresent('Callback Replace Content Test');
+
+ $this->assertText('subpanel', 'Sub Panel');
+ $this->assertText('panel1', 'regexp:Main Panel\s*Sub Panel');
+
+ $this->type('content', 'something');
+
+ $this->click('btn_append');
+ $this->pause(800);
+
+ $this->assertText('subpanel', 'Sub Panel something');
+ $this->assertText('panel1', 'regexp:Main Panel\s*Sub Panel\s*something');
+
+ $this->type('content', 'more');
+ $this->click('btn_prepend');
+ $this->pause(800);
+
+ $this->assertText('subpanel', 'regexp:more\s*Sub Panel\s*something');
+ $this->assertText('panel1', 'regexp:Main Panel\s*moreSub Panel\s*something');
+
+
+ $this->type('content', 'prado');
+ $this->click('btn_before');
+ $this->pause(800);
+
+ $this->assertText('subpanel', 'regexp:more\s*Sub Panel\s*something');
+ $this->assertText('panel1', 'regexp:Main Panel\s*prado\s*more\s*Sub Panel\s*something');
+
+ $this->type('content', ' php ');
+ $this->click('btn_after');
+ $this->pause(800);
+
+ $this->type('content', 'mauahahaha');
+ $this->click('btn_replace');
+ $this->pause(1000);
+
+ $this->assertText('panel1', 'Main Panel pradomauahahahaphp');
+ }
+
}
?>
\ No newline at end of file diff --git a/tests/test_tools/selenium/php/selenium.php b/tests/test_tools/selenium/php/selenium.php index fcbbe562..bfba617a 100644 --- a/tests/test_tools/selenium/php/selenium.php +++ b/tests/test_tools/selenium/php/selenium.php @@ -49,7 +49,7 @@ class SeleniumTestRunner if((php_sapi_name() == 'cli')) return; $file = dirname(__FILE__).'/TestRunner.php'; $driver = $this->driver; - + //$base_dir = $this->base_dir; $base_dir = $driver.'?sr='; include($file); @@ -130,20 +130,20 @@ class SeleneseInterpreter public function __call($func, $args) { if($func{0} == '_') return; - + $trace = debug_backtrace(); if($this->isTestOptionFunction($func,$args,$trace)) return; - + $ID = isset($args[0]) ? $args[0] : ""; $value = isset($args[1]) ? $args[1] : ""; if(strpos(strtolower($func),'htmlpresent') || strpos(strtolower($func),'htmlnotpresent')) $ID = htmlspecialchars($ID); $command = array($func, $ID, $value); - + if(is_int(strpos(strtolower($func), 'visible'))) $this->addCommand(array('pause','500',''),$trace); - + return $this->addCommand($command, $trace); } @@ -416,7 +416,7 @@ class SeleniumTestRunnerServer $case = $command[5]; $option=isset($options[$case])?$options[$case]:null; $this->cases[$case][] = - array('test' => $command[2], + array('test' => $command[2], 'trace' => $command[4], 'option'=>$option); if(is_null($this->name)) $this->name = $command[6]; @@ -528,7 +528,12 @@ class SeleniumTestCase extends UnitTestCase function skipBrowsers() { - $arg_list = func_get_args(); + $conditions = $this->getBrowserOptions(func_get_args()); + $this->selenium->skipCondition($conditions); + } + + protected function getBrowserOptions($arg_list) + { $browsers=array(); foreach($arg_list as $arg) { @@ -537,7 +542,13 @@ class SeleniumTestCase extends UnitTestCase else $browsers[] = $arg; } - $this->selenium->skipCondition(implode(' || ', $browsers)); + return implode(' || ', $browsers); + } + + function targetBrowsers() + { + $conditions = $this->getBrowserOptions(func_get_args()); + $this->selenium->skipCondition("!(".$conditions.")"); } } |