@applitools/dom-snapshot
Advanced tools
Comparing version 1.4.4 to 1.4.5
@@ -1,2 +0,2 @@ | ||
/* @applitools/dom-snapshot@1.4.3 */ | ||
/* @applitools/dom-snapshot@1.4.4 */ | ||
@@ -174,11 +174,23 @@ function __processPage() { | ||
if (elementNode.checked && !elementNode.attributes.checked) { | ||
node.attributes.push({name: 'checked', value: 'checked'}); | ||
if (elementNode.tagName === 'INPUT' && ['checkbox', 'radio'].includes(elementNode.type)) { | ||
if (elementNode.attributes.checked && !elementNode.checked) { | ||
const idx = node.attributes.findIndex(a => a.name === 'checked'); | ||
node.attributes.splice(idx, 1); | ||
} | ||
if (!elementNode.attributes.checked && elementNode.checked) { | ||
node.attributes.push({name: 'checked'}); | ||
} | ||
} | ||
if ( | ||
elementNode.value !== undefined && | ||
elementNode.attributes.value === undefined && | ||
elementNode.tagName === 'INPUT' | ||
elementNode.tagName === 'INPUT' && | ||
elementNode.type === 'text' && | ||
(elementNode.attributes.value && elementNode.attributes.value.value) !== elementNode.value | ||
) { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
const nodeAttr = node.attributes.find(a => a.name === 'value'); | ||
if (nodeAttr) { | ||
nodeAttr.value = elementNode.value; | ||
} else { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
} | ||
} | ||
@@ -185,0 +197,0 @@ return node; |
@@ -1,2 +0,2 @@ | ||
/* @applitools/dom-snapshot@1.4.3 */ | ||
/* @applitools/dom-snapshot@1.4.4 */ | ||
@@ -226,11 +226,23 @@ function __processPageAndPoll() { | ||
if (elementNode.checked && !elementNode.attributes.checked) { | ||
node.attributes.push({name: 'checked', value: 'checked'}); | ||
if (elementNode.tagName === 'INPUT' && ['checkbox', 'radio'].includes(elementNode.type)) { | ||
if (elementNode.attributes.checked && !elementNode.checked) { | ||
const idx = node.attributes.findIndex(a => a.name === 'checked'); | ||
node.attributes.splice(idx, 1); | ||
} | ||
if (!elementNode.attributes.checked && elementNode.checked) { | ||
node.attributes.push({name: 'checked'}); | ||
} | ||
} | ||
if ( | ||
elementNode.value !== undefined && | ||
elementNode.attributes.value === undefined && | ||
elementNode.tagName === 'INPUT' | ||
elementNode.tagName === 'INPUT' && | ||
elementNode.type === 'text' && | ||
(elementNode.attributes.value && elementNode.attributes.value.value) !== elementNode.value | ||
) { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
const nodeAttr = node.attributes.find(a => a.name === 'value'); | ||
if (nodeAttr) { | ||
nodeAttr.value = elementNode.value; | ||
} else { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
} | ||
} | ||
@@ -237,0 +249,0 @@ return node; |
@@ -1,2 +0,2 @@ | ||
/* @applitools/dom-snapshot@1.4.3 */ | ||
/* @applitools/dom-snapshot@1.4.4 */ | ||
@@ -226,11 +226,23 @@ function __processPageAndSerialize() { | ||
if (elementNode.checked && !elementNode.attributes.checked) { | ||
node.attributes.push({name: 'checked', value: 'checked'}); | ||
if (elementNode.tagName === 'INPUT' && ['checkbox', 'radio'].includes(elementNode.type)) { | ||
if (elementNode.attributes.checked && !elementNode.checked) { | ||
const idx = node.attributes.findIndex(a => a.name === 'checked'); | ||
node.attributes.splice(idx, 1); | ||
} | ||
if (!elementNode.attributes.checked && elementNode.checked) { | ||
node.attributes.push({name: 'checked'}); | ||
} | ||
} | ||
if ( | ||
elementNode.value !== undefined && | ||
elementNode.attributes.value === undefined && | ||
elementNode.tagName === 'INPUT' | ||
elementNode.tagName === 'INPUT' && | ||
elementNode.type === 'text' && | ||
(elementNode.attributes.value && elementNode.attributes.value.value) !== elementNode.value | ||
) { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
const nodeAttr = node.attributes.find(a => a.name === 'value'); | ||
if (nodeAttr) { | ||
nodeAttr.value = elementNode.value; | ||
} else { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
} | ||
} | ||
@@ -237,0 +249,0 @@ return node; |
@@ -1,2 +0,2 @@ | ||
/* @applitools/dom-snapshot@1.4.3 */ | ||
/* @applitools/dom-snapshot@1.4.4 */ | ||
'use strict'; | ||
@@ -171,11 +171,23 @@ | ||
if (elementNode.checked && !elementNode.attributes.checked) { | ||
node.attributes.push({name: 'checked', value: 'checked'}); | ||
if (elementNode.tagName === 'INPUT' && ['checkbox', 'radio'].includes(elementNode.type)) { | ||
if (elementNode.attributes.checked && !elementNode.checked) { | ||
const idx = node.attributes.findIndex(a => a.name === 'checked'); | ||
node.attributes.splice(idx, 1); | ||
} | ||
if (!elementNode.attributes.checked && elementNode.checked) { | ||
node.attributes.push({name: 'checked'}); | ||
} | ||
} | ||
if ( | ||
elementNode.value !== undefined && | ||
elementNode.attributes.value === undefined && | ||
elementNode.tagName === 'INPUT' | ||
elementNode.tagName === 'INPUT' && | ||
elementNode.type === 'text' && | ||
(elementNode.attributes.value && elementNode.attributes.value.value) !== elementNode.value | ||
) { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
const nodeAttr = node.attributes.find(a => a.name === 'value'); | ||
if (nodeAttr) { | ||
nodeAttr.value = elementNode.value; | ||
} else { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
} | ||
} | ||
@@ -182,0 +194,0 @@ return node; |
{ | ||
"name": "@applitools/dom-snapshot", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -114,11 +114,23 @@ /* eslint-disable no-use-before-define */ | ||
if (elementNode.checked && !elementNode.attributes.checked) { | ||
node.attributes.push({name: 'checked', value: 'checked'}); | ||
if (elementNode.tagName === 'INPUT' && ['checkbox', 'radio'].includes(elementNode.type)) { | ||
if (elementNode.attributes.checked && !elementNode.checked) { | ||
const idx = node.attributes.findIndex(a => a.name === 'checked'); | ||
node.attributes.splice(idx, 1); | ||
} | ||
if (!elementNode.attributes.checked && elementNode.checked) { | ||
node.attributes.push({name: 'checked'}); | ||
} | ||
} | ||
if ( | ||
elementNode.value !== undefined && | ||
elementNode.attributes.value === undefined && | ||
elementNode.tagName === 'INPUT' | ||
elementNode.tagName === 'INPUT' && | ||
elementNode.type === 'text' && | ||
(elementNode.attributes.value && elementNode.attributes.value.value) !== elementNode.value | ||
) { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
const nodeAttr = node.attributes.find(a => a.name === 'value'); | ||
if (nodeAttr) { | ||
nodeAttr.value = elementNode.value; | ||
} else { | ||
node.attributes.push({name: 'value', value: elementNode.value}); | ||
} | ||
} | ||
@@ -125,0 +137,0 @@ return node; |
Sorry, the diff of this file is too big to display
579960
12318