Disabled/Enabled RW - events propagation - questions

Juraj Húska jhuska at redhat.com
Wed Nov 6 03:06:51 EST 2013


Hopefully some code will speak better than words. Consider this snippet of testing +disable+ option of a +pickList.+

{code:jivemacro_uid=_13837251212174852|class=jive_text_macro jive_macro_code _jivemacro_uid_13837251212174852}
function test(fixture, element) {

        // given

        var changeCallback = jasmine.createSpy('changeCallback');



        var options = {

          disabled: true,

          change: changeCallback

        };

        // when

        element.pickList(options);



        // then - some interactions with pick list via JQuery - it changes the pickList (e.g. item is dragged)

        runs(function () {

          var firstSourceItem = element.find('.source .ui-selectee').first();

          var firstTargetItem = element.find('.target .ui-selectee').first();

          pickListFragment.dragItem(firstSourceItem, 400, 20);

          pickListFragment.dragItem(firstTargetItem, -400, 20);

          pickListFragment.selectItem(firstSourceItem);

          pickListFragment.clickAddButton(fixture);

          pickListFragment.selectItem(firstTargetItem);

          pickListFragment.clickRemoveButton(fixture);

        });



        //however, here I expect that the change callback was not called and it was even when pickList is disabled

        runs(function () {

          expect(changeCallback).not.toHaveBeenCalled();

        });



        options = {

          disabled: false,

        };

        element.pickList(options);

}
{code}

Is that clear what I am trying to say now ? Am I missing something ?

Posted by forums
Original post: https://community.jboss.org/message/844687#844687



More information about the richfaces-dev mailing list