implemented test, but again not supported yet by jsdom

This commit is contained in:
El RIDO 2017-10-22 16:26:41 +02:00
parent 4410ddcd84
commit ef6b6816b0
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92

View file

@ -860,7 +860,8 @@ describe('UiHelper', function () {
jsc.array(jsc.elements(queryString)),
jsc.nearray(jsc.elements(base64String)),
function (schema, address, query, fragment) {
var expected = schema + '://' + address.join('') + '/' + '?' + query.join('') + '#' + fragment.join(''),
var expected = schema + '://' + address.join('') + '/' + '?' +
query.join('') + '#' + fragment.join(''),
clean = jsdom('', {url: expected});
// make window.location.href writable
@ -868,7 +869,9 @@ describe('UiHelper', function () {
writable: true,
value: window.location.href
});
$.PrivateBin.UiHelper.mockHistoryChange([{type: 'newpaste'}, '', expected]);
$.PrivateBin.UiHelper.mockHistoryChange([
{type: 'newpaste'}, '', expected
]);
$.PrivateBin.Helper.reset();
var result = window.location.href;
clean();
@ -891,7 +894,9 @@ describe('UiHelper', function () {
jsc.nearray(jsc.elements(base64String)),
function (schema, address, query, fragment) {
var expected = schema + '://' + address.join('') + '/',
clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment.join('')});
clean = jsdom('', {
url: expected + '?' + query.join('') + '#' + fragment.join('')
});
// make window.location.href writable
Object.defineProperty(window.location, 'href', {
@ -906,5 +911,29 @@ describe('UiHelper', function () {
}
);
});
describe('isVisible', function () {
before(function () {
$.PrivateBin.Helper.reset();
});
jsc.property(
'detect visible elements',
jsc.nearray(jsc.elements(alnumString)),
jsc.nearray(jsc.elements(a2zString)),
function (id, element) {
id = id.join('');
element = element.join('');
var clean = jsdom(
'<' + element + ' id="' + id + '"></' + element + '>'
);
// TODO As per https://github.com/tmpvar/jsdom/issues/1048 there is no layout support in jsdom, yet.
// remove the "true || " below, once it is supported or a workaround is found
var result = true || $.PrivateBin.UiHelper.isVisible($('#' + id));
clean();
return result;
}
);
});
});