-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1756 from BladeRunnerJS/1755/bugfix-ensuresvg-ele…
…ments-work-in-IE11 1755/bugfix ensure svg elements work in ie11
- Loading branch information
Showing
6 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 50 additions & 11 deletions
61
brjs-sdk/sdk/libs/javascript/br-util/test-unit/tests/br/util/ElementUtilityTest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,61 @@ | ||
(function() { | ||
var ElementUtility = require('br/util/ElementUtility'); | ||
|
||
ElementUtilityTest = TestCase('ElementUtilityTest'); | ||
var testCaseName = 'ElementUtilityTest'; | ||
var testCase = { | ||
'test #setNodeText sets the text contents on an empty element': function() { | ||
var element = document.createElement('DIV'); | ||
|
||
ElementUtilityTest.prototype.test_setNodeText_SetsTheTextContentsOnAEmptyElement = function() { | ||
var element = document.createElement('DIV'); | ||
ElementUtility.setNodeText(element, 'foo'); | ||
|
||
ElementUtility.setNodeText(element, 'foo'); | ||
assertEquals(element.innerHTML, 'foo'); | ||
}, | ||
|
||
assertEquals(element.innerHTML, 'foo'); | ||
}; | ||
'test #setNodeText sets the text contents on a non empty element': function() { | ||
var element = document.createElement('DIV'); | ||
element.innerHTML = 'bar'; | ||
|
||
ElementUtility.setNodeText(element, 'foo'); | ||
|
||
assertEquals(element.innerHTML, 'foo'); | ||
}, | ||
|
||
'test #getAncestorElementWithClass returns current element when it has matching class': function() { | ||
var element = document.createElement('DIV'); | ||
element.className = "myClass"; | ||
|
||
var returnElement = ElementUtility.getAncestorElementWithClass(element, "myClass"); | ||
|
||
assertEquals(element, returnElement); | ||
}, | ||
|
||
'test #getAncestorElementWithClass returns current element when it has multiple classes including the matching class': function() { | ||
var element = document.createElement('DIV'); | ||
element.className = "myClass myOtherClass"; | ||
|
||
ElementUtilityTest.prototype.test_setNodeText_SetsTheTextContentsOnANonEmptyElement = function() { | ||
var element = document.createElement('DIV'); | ||
element.innerHTML = 'bar'; | ||
var returnElement = ElementUtility.getAncestorElementWithClass(element, "myClass"); | ||
|
||
ElementUtility.setNodeText(element, 'foo'); | ||
assertEquals(element, returnElement); | ||
}, | ||
|
||
'test #getAncestorElementWithClass returns null when using an svg element with no class': function() { | ||
var element = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
|
||
var returnElement = ElementUtility.getAncestorElementWithClass(element, "myClass"); | ||
|
||
assertEquals(null, returnElement); | ||
}, | ||
|
||
'test #getAncestorElementWithClass returns current element when using an svg element containing the matching class': function() { | ||
var element = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
element.setAttribute("class", "myClass myOtherClass"); | ||
|
||
var returnElement = ElementUtility.getAncestorElementWithClass(element, "myOtherClass"); | ||
|
||
assertEquals(element, returnElement); | ||
} | ||
|
||
assertEquals(element.innerHTML, 'foo'); | ||
}; | ||
|
||
return new TestCase(testCaseName, testCase); | ||
})(); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"milestone": "1.5.8", | ||
"name": "BladeRunnerJS 1.5.8", | ||
"prerelease": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## BladeRunnerJS @tagVersion@ | ||
|
||
BladeRunnerJS @tagVersion@ contains one minor bug fix. | ||
|
||
### Bug Fixes | ||
|
||
- Fixed a bug where ElementUtility would throw an error in IE11 when using SVG elements |