-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
283 additions
and
183 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>classList.remove</title> | ||
</head> | ||
<body> | ||
|
||
<h1>classList.remove</h1> | ||
|
||
<div id="native-simple" class="hi yo"></div> | ||
<div id="native-repeat" class="yo yo yo"></div> | ||
<div id="native-list" class="hi yo hello"></div> | ||
<script> | ||
try { | ||
document.getElementById('native-simple').classList.remove('yo'); | ||
document.getElementById('native-repeat').classList.remove('yo'); | ||
document.getElementById('native-list').classList.remove('yo'); | ||
} catch(e) {}; | ||
</script> | ||
|
||
<div id="polyfilled-simple" class="hi yo"></div> | ||
<div id="polyfilled-repeat" class="yo yo yo"></div> | ||
<div id="polyfilled-list" class="hi yo hello"></div> | ||
<script src="/classList.js"></script> | ||
<script> | ||
document.getElementById('polyfilled-simple').classList.remove('yo'); | ||
document.getElementById('polyfilled-repeat').classList.remove('yo'); | ||
document.getElementById('polyfilled-list').classList.remove('yo'); | ||
</script> | ||
|
||
</body> | ||
</html> |
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,30 @@ | ||
'use strict'; | ||
|
||
describe('.classList.remove', function() { | ||
|
||
before(function() { | ||
browser.url('test/specs/remove.html'); | ||
if( | ||
browser.getAttribute('#native-simple', 'class') === 'hi' && | ||
browser.getAttribute('#native-repeat', 'class') === '' && | ||
browser.getAttribute('#native-list', 'class').includes('yo') == false | ||
) { | ||
browser.logger.info(`${agent} skipping .remove`); | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('removes "yo"', function() { | ||
expect(browser.getAttribute('#polyfilled-simple', 'class')).to.equal('hi'); | ||
}); | ||
|
||
it('removes all instances of "yo"', function() { | ||
expect(browser.getAttribute('#polyfilled-repeat', 'class')).to.equal(''); | ||
}); | ||
|
||
it('removes "yo" from a list of classes', function() { | ||
const classStr = browser.getAttribute('#polyfilled-list', 'class'); | ||
expect(classStr).to.not.include('yo'); | ||
}); | ||
|
||
}); |
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,41 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>svgElement.classList</title> | ||
<style> | ||
.red { | ||
fill: red; | ||
} | ||
.green { | ||
fill: green; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<h1>svgElement.classList</h1> | ||
|
||
<svg id="native" class="red" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M50,3l12,36h38l-30,22l11,36l-31-21l-31,21l11-36l-30-22h38z"> | ||
</svg> | ||
|
||
<script> | ||
try { | ||
document.getElementById('native').classList.remove('red'); | ||
document.getElementById('native').classList.toggle('green'); | ||
} catch(e) {}; | ||
</script> | ||
|
||
<svg id="polyfilled" class="red" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M50,3l12,36h38l-30,22l11,36l-31-21l-31,21l11-36l-30-22h38z"> | ||
</svg> | ||
|
||
<script src="/classList.js"></script> | ||
<script> | ||
document.getElementById('polyfilled').classList.remove('red'); | ||
document.getElementById('polyfilled').classList.toggle('green'); | ||
</script> | ||
|
||
</body> | ||
</html> |
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,18 @@ | ||
'use strict'; | ||
|
||
describe('svgElement.classList', function() { | ||
|
||
before(function() { | ||
browser.url('test/specs/svg.html'); | ||
if(browser.getAttribute('#native', 'class') == 'green') { | ||
browser.logger.info(`${agent} skipping svg .classList`); | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('has "red" removed and "green" toggled on', function() { | ||
const classStr = browser.getAttribute('#polyfilled', 'class'); | ||
expect(classStr).to.equal('green'); | ||
}); | ||
|
||
}); |
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,59 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>classList.toggle</title> | ||
</head> | ||
<body> | ||
|
||
<h1>classList.remove</h1> | ||
|
||
|
||
<div id="native-on"></div> | ||
<div id="native-off" class="yo"></div> | ||
<div id="native-force-on" class="yo"></div> | ||
<div id="native-force-off"></div> | ||
<script> | ||
try { | ||
var el; | ||
|
||
el = document.getElementById('native-on') | ||
window.nativeToggleOn = el.classList.toggle('yo'); | ||
|
||
el = document.getElementById('native-off') | ||
window.nativeToggleOff = el.classList.toggle('yo'); | ||
|
||
el = document.getElementById('native-force-on'); | ||
window.nativeToggleForceOn = el.classList.toggle('yo', true); | ||
|
||
el = document.getElementById('native-force-off'); | ||
window.nativeToggleForceOff = el.classList.toggle('yo', false); | ||
|
||
} catch(e) {}; | ||
</script> | ||
|
||
|
||
<div id="polyfilled-on"></div> | ||
<div id="polyfilled-off" class="yo"></div> | ||
<div id="polyfilled-force-on" class="yo"></div> | ||
<div id="polyfilled-force-off"></div> | ||
<script src="/classList.js"></script> | ||
<script> | ||
var el; | ||
|
||
el = document.getElementById('polyfilled-on') | ||
window.polyfilledToggleOn = el.classList.toggle('yo'); | ||
|
||
el = document.getElementById('polyfilled-off') | ||
window.polyfilledToggleOff = el.classList.toggle('yo'); | ||
|
||
el = document.getElementById('polyfilled-force-on'); | ||
window.polyfilledToggleForceOn = el.classList.toggle('yo', true); | ||
|
||
el = document.getElementById('polyfilled-force-off'); | ||
window.polyfilledToggleForceOff = el.classList.toggle('yo', false) | ||
</script> | ||
|
||
|
||
</body> | ||
</html> |
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,81 @@ | ||
'use strict'; | ||
|
||
describe('.classList.toggle', function() { | ||
|
||
before(function() { | ||
browser.url('test/specs/toggle.html'); | ||
if( | ||
browser.getAttribute('#native-on', 'class') === 'yo' && | ||
browser.getAttribute('#native-off', 'class') === '' && | ||
browser.getAttribute('#native-force-on', 'class') == 'yo' && | ||
browser.getAttribute('#native-force-off', 'class') == '' | ||
) { | ||
browser.logger.info(`${agent} skipping .toggle`); | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('adds class "yo"', function() { | ||
const classStr = browser.getAttribute('#polyfilled-on', 'class'); | ||
expect(classStr).to.equal('yo'); | ||
}); | ||
|
||
it('removes class "yo"', function() { | ||
const classStr = browser.getAttribute('#polyfilled-off', 'class'); | ||
expect(classStr).to.equal(''); | ||
}); | ||
|
||
it('retains class "yo" when force is `true`', function() { | ||
const classStr = browser.getAttribute('#polyfilled-force-on', 'class'); | ||
expect(classStr).to.equal('yo'); | ||
}); | ||
|
||
it('does not add a class when force is `false`', function() { | ||
const classStr = browser.getAttribute('#polyfilled-force-off', 'class'); | ||
expect(classStr).to.equal(''); | ||
}); | ||
|
||
}); | ||
|
||
|
||
describe('.classList.toggle return', function() { | ||
|
||
before(function() { | ||
browser.url('test/specs/toggle.html'); | ||
const toggleOn = browser.execute('return window.nativeToggleOn').value; | ||
const toggleOff = browser.execute('return window.nativeToggleOff').value; | ||
const toggleForceOn = browser.execute('return window.nativeToggleForceOn').value; | ||
const toggleForceOff = browser.execute('return window.nativeToggleForceOff').value; | ||
|
||
if( | ||
toggleOn === true && | ||
toggleOff === false && | ||
toggleForceOn === true && | ||
toggleForceOff === false | ||
) { | ||
browser.logger.info(`${agent} skipping .toggle return`); | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('is `true` when class is toggled on', function() { | ||
const returnVal = browser.execute('return window.polyfilledToggleOn').value; | ||
expect(returnVal).to.equal(true); | ||
}); | ||
|
||
it('is `false` when class is toggled off', function() { | ||
const returnVal = browser.execute('return window.polyfilledToggleOff').value; | ||
expect(returnVal).to.equal(false); | ||
}); | ||
|
||
it('is `true` when force is `true`', function() { | ||
const returnVal = browser.execute('return window.polyfilledToggleForceOn').value; | ||
expect(returnVal).to.equal(true); | ||
}); | ||
|
||
it('is `false` when force is `false`', function() { | ||
const returnVal = browser.execute('return window.polyfilledToggleForceOff').value; | ||
expect(returnVal).to.equal(false); | ||
}); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.