0 Replies Latest reply on Dec 4, 2010 3:22 AM by nikos101

    Need some advice on testing view.

    nikos101 Level 2

      I'm breaking into the world of tdd.

       

      I would like some advice on how to Unit test this renderer. Should I simulate click events in the CheckBox and test the data is modified correctly.

      Note I had to give the CheckBox an  id="cb"  otherwise the data variable doesn't get picked up in the renderer

       

      <mx:AdvancedDataGridColumn headerText="Comments view" dataField="commentsView" textAlign="right" editable="false">
                      <mx:itemRenderer>
                         
                          <fx:Component>       
                             
                              <s:MXAdvancedDataGridItemRenderer>   
                                 
                                  <s:CheckBox width="100%" id="cb"   fontWeight="bold" color="#3333ff" >
                                      <s:click>
                                          <![CDATA[
                                          this.data.isModifiedClientSide = 1;
                                          this.data.commentsView = cb.selected;
                                          ]]>
                                      </s:click>
                                     
                                  </s:CheckBox>                                       
                                 
                              </s:MXAdvancedDataGridItemRenderer>                                       
                          </fx:Component>               
                      </mx:itemRenderer>
                  </mx:AdvancedDataGridColumn>