|
Lines 746-752
Link Here
|
| 746 |
assertEquals( [ 0, 70 ], position ); |
746 |
assertEquals( [ 0, 70 ], position ); |
| 747 |
list.destroy(); |
747 |
list.destroy(); |
| 748 |
}, |
748 |
}, |
| 749 |
|
749 |
|
|
|
750 |
|
| 751 |
testApplyCustomVariantToExistingItems : function() { |
| 752 |
var TestUtil = org.eclipse.rwt.test.fixture.TestUtil; |
| 753 |
var shell = TestUtil.createShellByProtocol( "w2" ); |
| 754 |
var processor = org.eclipse.rwt.protocol.Processor; |
| 755 |
processor.processOperation( { |
| 756 |
"target" : "w3", |
| 757 |
"action" : "create", |
| 758 |
"type" : "rwt.widgets.List", |
| 759 |
"properties" : { |
| 760 |
"style" : [ "MULTI" ], |
| 761 |
"parent" : "w2", |
| 762 |
"items" : [ "a", "b", "c" ] |
| 763 |
} |
| 764 |
} ); |
| 765 |
|
| 766 |
TestUtil.protocolSet( "w3", { "customVariant" : "variant_myVariant" } ); |
| 767 |
|
| 768 |
var ObjectManager = org.eclipse.rwt.protocol.ObjectManager; |
| 769 |
var widget = ObjectManager.getObject( "w3" ); |
| 770 |
var items = widget.getItems(); |
| 771 |
assertTrue( items[ 0 ].hasState( "variant_myVariant" ) ); |
| 772 |
assertTrue( items[ 1 ].hasState( "variant_myVariant" ) ); |
| 773 |
assertTrue( items[ 2 ].hasState( "variant_myVariant" ) ); |
| 774 |
shell.destroy(); |
| 775 |
widget.destroy(); |
| 776 |
}, |
| 777 |
|
| 778 |
testApplyCustomVariantToNewItems : function() { |
| 779 |
var TestUtil = org.eclipse.rwt.test.fixture.TestUtil; |
| 780 |
var shell = TestUtil.createShellByProtocol( "w2" ); |
| 781 |
var processor = org.eclipse.rwt.protocol.Processor; |
| 782 |
processor.processOperation( { |
| 783 |
"target" : "w3", |
| 784 |
"action" : "create", |
| 785 |
"type" : "rwt.widgets.List", |
| 786 |
"properties" : { |
| 787 |
"style" : [ "MULTI" ], |
| 788 |
"parent" : "w2", |
| 789 |
"customVariant" : "variant_myVariant" |
| 790 |
} |
| 791 |
} ); |
| 792 |
TestUtil.flush(); |
| 793 |
|
| 794 |
TestUtil.protocolSet( "w3", { "items" : [ "a", "b", "c" ] } ); |
| 795 |
|
| 796 |
var ObjectManager = org.eclipse.rwt.protocol.ObjectManager; |
| 797 |
var widget = ObjectManager.getObject( "w3" ); |
| 798 |
var items = widget.getItems(); |
| 799 |
assertTrue( items[ 0 ].hasState( "variant_myVariant" ) ); |
| 800 |
assertTrue( items[ 1 ].hasState( "variant_myVariant" ) ); |
| 801 |
assertTrue( items[ 2 ].hasState( "variant_myVariant" ) ); |
| 802 |
shell.destroy(); |
| 803 |
widget.destroy(); |
| 804 |
TestUtil.flush(); |
| 805 |
}, |
| 806 |
|
| 807 |
testReplaceCustomVariant : function() { |
| 808 |
var TestUtil = org.eclipse.rwt.test.fixture.TestUtil; |
| 809 |
var shell = TestUtil.createShellByProtocol( "w2" ); |
| 810 |
var processor = org.eclipse.rwt.protocol.Processor; |
| 811 |
processor.processOperation( { |
| 812 |
"target" : "w3", |
| 813 |
"action" : "create", |
| 814 |
"type" : "rwt.widgets.List", |
| 815 |
"properties" : { |
| 816 |
"style" : [ "MULTI" ], |
| 817 |
"parent" : "w2", |
| 818 |
"customVariant" : "variant_myVariant", |
| 819 |
"items" : [ "a", "b", "c" ] |
| 820 |
} |
| 821 |
} ); |
| 822 |
TestUtil.flush(); |
| 823 |
|
| 824 |
TestUtil.protocolSet( "w3", { "customVariant" : "variant_other" } ); |
| 825 |
|
| 826 |
var ObjectManager = org.eclipse.rwt.protocol.ObjectManager; |
| 827 |
var widget = ObjectManager.getObject( "w3" ); |
| 828 |
var items = widget.getItems(); |
| 829 |
assertFalse( items[ 0 ].hasState( "variant_myVariant" ) ); |
| 830 |
assertFalse( items[ 1 ].hasState( "variant_myVariant" ) ); |
| 831 |
assertFalse( items[ 2 ].hasState( "variant_myVariant" ) ); |
| 832 |
assertTrue( items[ 0 ].hasState( "variant_other" ) ); |
| 833 |
assertTrue( items[ 1 ].hasState( "variant_other" ) ); |
| 834 |
assertTrue( items[ 2 ].hasState( "variant_other" ) ); |
| 835 |
shell.destroy(); |
| 836 |
widget.destroy(); |
| 837 |
}, |
| 838 |
|
| 750 |
////////// |
839 |
////////// |
| 751 |
// Helpers |
840 |
// Helpers |
| 752 |
|
841 |
|