CSS3_workarounds_spec.js 1.31 KB
Newer Older
1 2 3 4 5 6 7 8
describe('CSS3 workarounds', function() {
    'use strict';
    var pointerEventsNone = window.pointerEventsNone;
    describe('pointer-events', function() {
        beforeEach(function() {
            var html = "<a href='#' class='is-disabled'>What wondrous life in this I lead</a>";
            setFixtures(html);
        });
9

10 11 12 13 14 15 16 17
        it('should not prevent default when pointerEvents is supported', function() {
            // In case this test suite is being run in a browser where
            // 'pointerEvents' is not supported, mock out document.body.style
            // so that it includes 'pointerEvents'
            var mockBodyStyle = document.body.style;
            if (!('pointerEvents' in mockBodyStyle)) {
                mockBodyStyle['pointerEvents'] = '';
            }
18

19 20 21 22 23
            pointerEventsNone('.is-disabled', mockBodyStyle);
            spyOnEvent('.is-disabled', 'click');
            $('.is-disabled').click();
            expect('click').not.toHaveBeenPreventedOn('.is-disabled');
        });
24

25 26 27 28 29 30 31
        it('should prevent default when pointerEvents is not Supported', function() {
            pointerEventsNone('.is-disabled', {});
            spyOnEvent('.is-disabled', 'click');
            $('.is-disabled').click();
            expect('click').toHaveBeenPreventedOn('.is-disabled');
        });
    });
32
});