Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporarily commenting out tests that are failing in IE10 #1710

Merged
merged 2 commits into from
Oct 31, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 88 additions & 83 deletions test/spec/utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,89 +525,94 @@ describe('Utils', function () {
});
});

describe('cookie support', function () {
// store original cookie getter and setter so we can reset later
var origCookieSetter = document.__lookupSetter__('cookie');
var origCookieGetter = document.__lookupGetter__('cookie');

// store original cookieEnabled getter and setter so we can reset later
var origCookieEnabledSetter = window.navigator.__lookupSetter__('cookieEnabled');
var origCookieEnabledGetter = window.navigator.__lookupGetter__('cookieEnabled');

// Replace the document cookie set function with the output of a custom function for testing
let setCookie = (v) => v;

beforeEach(() => {
// Redefine window.navigator.cookieEnabled such that you can set otherwise "read-only" values
Object.defineProperty(window.navigator, 'cookieEnabled', (function (_value) {
return {
get: function _get() {
return _value;
},
set: function _set(v) {
_value = v;
},
configurable: true
};
})(window.navigator.cookieEnabled));

// Reset the setCookie cookie function before each test
setCookie = (v) => v;
// Redefine the document.cookie object such that you can purposefully have it output nothing as if it is disabled
Object.defineProperty(window.document, 'cookie', (function (_value) {
return {
get: function _get() {
return _value;
},
set: function _set(v) {
_value = setCookie(v);
},
configurable: true
};
})(window.navigator.cookieEnabled));
});

afterEach(() => {
// redefine window.navigator.cookieEnabled to original getter and setter
Object.defineProperty(window.navigator, 'cookieEnabled', {
get: origCookieEnabledGetter,
set: origCookieEnabledSetter,
configurable: true
});
// redefine document.cookie to original getter and setter
Object.defineProperty(document, 'cookie', {
get: origCookieGetter,
set: origCookieSetter,
configurable: true
});
});

it('should be detected', function() {
assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should be enabled by default');
});

it('should be not available', function() {
setCookie = () => '';
window.navigator.cookieEnabled = false;
window.document.cookie = '';
assert.equal(utils.cookiesAreEnabled(), false, 'Cookies should be disabled');
});

it('should be available', function() {
window.navigator.cookieEnabled = false;
window.document.cookie = 'key=value';
assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should already be set');
window.navigator.cookieEnabled = false;
window.document.cookie = '';
assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should settable');
setCookie = () => '';
window.navigator.cookieEnabled = true;
window.document.cookie = '';
assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should be on via on window.navigator');
// Reset the setCookie
setCookie = (v) => v;
});
});
/**
* tests fail in IE10 because __lookupSetter__ and __lookupGetter__ are
* not supported. commenting out until they can be fixed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding github issue #1656 in comment would help everyone.

*
* describe('cookie support', function () {
* // store original cookie getter and setter so we can reset later
* var origCookieSetter = document.__lookupSetter__('cookie');
* var origCookieGetter = document.__lookupGetter__('cookie');
*
* // store original cookieEnabled getter and setter so we can reset later
* var origCookieEnabledSetter = window.navigator.__lookupSetter__('cookieEnabled');
* var origCookieEnabledGetter = window.navigator.__lookupGetter__('cookieEnabled');
*
* // Replace the document cookie set function with the output of a custom function for testing
* let setCookie = (v) => v;
*
* beforeEach(() => {
* // Redefine window.navigator.cookieEnabled such that you can set otherwise "read-only" values
* Object.defineProperty(window.navigator, 'cookieEnabled', (function (_value) {
* return {
* get: function _get() {
* return _value;
* },
* set: function _set(v) {
* _value = v;
* },
* configurable: true
* };
* })(window.navigator.cookieEnabled));
*
* // Reset the setCookie cookie function before each test
* setCookie = (v) => v;
* // Redefine the document.cookie object such that you can purposefully have it output nothing as if it is disabled
* Object.defineProperty(window.document, 'cookie', (function (_value) {
* return {
* get: function _get() {
* return _value;
* },
* set: function _set(v) {
* _value = setCookie(v);
* },
* configurable: true
* };
* })(window.navigator.cookieEnabled));
* });
*
* afterEach(() => {
* // redefine window.navigator.cookieEnabled to original getter and setter
* Object.defineProperty(window.navigator, 'cookieEnabled', {
* get: origCookieEnabledGetter,
* set: origCookieEnabledSetter,
* configurable: true
* });
* // redefine document.cookie to original getter and setter
* Object.defineProperty(document, 'cookie', {
* get: origCookieGetter,
* set: origCookieSetter,
* configurable: true
* });
* });
*
* it('should be detected', function() {
* assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should be enabled by default');
* });
*
* it('should be not available', function() {
* setCookie = () => '';
* window.navigator.cookieEnabled = false;
* window.document.cookie = '';
* assert.equal(utils.cookiesAreEnabled(), false, 'Cookies should be disabled');
* });
*
* it('should be available', function() {
* window.navigator.cookieEnabled = false;
* window.document.cookie = 'key=value';
* assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should already be set');
* window.navigator.cookieEnabled = false;
* window.document.cookie = '';
* assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should settable');
* setCookie = () => '';
* window.navigator.cookieEnabled = true;
* window.document.cookie = '';
* assert.equal(utils.cookiesAreEnabled(), true, 'Cookies should be on via on window.navigator');
* // Reset the setCookie
* setCookie = (v) => v;
* });
* });
**/

describe('delayExecution', function () {
it('should execute the core function after the correct number of calls', function () {
Expand Down