-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 6f54278
Showing
8 changed files
with
211 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# \<deep-intersection-observer\> | ||
|
||
Polymer element providing import of intersection observer polyfill. | ||
|
||
## Install the Polymer-CLI | ||
|
||
First, make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed. Then run `polymer serve` to serve your element locally. | ||
|
||
## Viewing Your Element | ||
|
||
``` | ||
$ polymer serve | ||
``` | ||
|
||
## Running Tests | ||
|
||
``` | ||
$ polymer test | ||
``` | ||
|
||
Your application is already set up to be tested via [web-component-tester](https://github.com/Polymer/web-component-tester). Run `polymer test` to run your application's test suite locally. |
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,31 @@ | ||
{ | ||
"name": "deep-intersection-observer", | ||
"description": "Polymer element providing import of intersection observer polyfill.", | ||
"main": "deep-intersection-observer.html", | ||
"dependencies": { | ||
"polymer": "Polymer/polymer#^1.0 || ^2.0" | ||
}, | ||
"devDependencies": { | ||
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^2.0.0", | ||
"web-component-tester": "Polymer/web-component-tester#^6.0.0", | ||
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0" | ||
}, | ||
"resolutions": { | ||
"polymer": "^2.0.0" | ||
}, | ||
"variants": { | ||
"1.x": { | ||
"dependencies": { | ||
"polymer": "Polymer/polymer#^1.9" | ||
}, | ||
"devDependencies": { | ||
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0", | ||
"web-component-tester": "Polymer/web-component-tester#^4.0.0", | ||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" | ||
}, | ||
"resolutions": { | ||
"webcomponentsjs": "^0.7" | ||
} | ||
} | ||
} | ||
} |
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,36 @@ | ||
<link rel="import" href="../polymer/polymer-element.html"> | ||
|
||
<dom-module id="deep-intersection-observer"> | ||
<template> | ||
<style> | ||
:host { | ||
display: block; | ||
} | ||
</style> | ||
<h2>Hello [[prop1]]!</h2> | ||
</template> | ||
|
||
<script> | ||
/** | ||
* `deep-intersection-observer` | ||
* Polymer element providing import of intersection observer polyfill. | ||
* | ||
* @customElement | ||
* @polymer | ||
* @demo demo/index.html | ||
*/ | ||
class DeepIntersectionObserver extends Polymer.Element { | ||
static get is() { return 'deep-intersection-observer'; } | ||
static get properties() { | ||
return { | ||
prop1: { | ||
type: String, | ||
value: 'deep-intersection-observer' | ||
} | ||
}; | ||
} | ||
} | ||
|
||
window.customElements.define(DeepIntersectionObserver.is, DeepIntersectionObserver); | ||
</script> | ||
</dom-module> |
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 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"> | ||
|
||
<title>deep-intersection-observer demo</title> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
|
||
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html"> | ||
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html"> | ||
<link rel="import" href="../deep-intersection-observer.html"> | ||
|
||
<custom-style> | ||
<style is="custom-style" include="demo-pages-shared-styles"> | ||
</style> | ||
</custom-style> | ||
</head> | ||
<body> | ||
<div class="vertical-section-container centered"> | ||
<h3>Basic deep-intersection-observer demo</h3> | ||
<demo-snippet> | ||
<template> | ||
<deep-intersection-observer></deep-intersection-observer> | ||
</template> | ||
</demo-snippet> | ||
</div> | ||
</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,16 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="refresh" content="0;url=demo/" /> | ||
<title>deep-intersection-observer</title> | ||
</head> | ||
<body> | ||
<!-- | ||
ELEMENT API DOCUMENTATION SUPPORT COMING SOON | ||
Visit demo/index.html to see live examples of your element running. | ||
This page will automatically redirect you there when run in the browser | ||
with `polymer serve`. | ||
--> | ||
</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,7 @@ | ||
{ | ||
"lint": { | ||
"rules": [ | ||
"polymer-2" | ||
] | ||
} | ||
} |
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,52 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"> | ||
|
||
<title>deep-intersection-observer test</title> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
|
||
<link rel="import" href="../deep-intersection-observer.html"> | ||
</head> | ||
<body> | ||
|
||
<test-fixture id="BasicTestFixture"> | ||
<template> | ||
<deep-intersection-observer></deep-intersection-observer> | ||
</template> | ||
</test-fixture> | ||
|
||
<test-fixture id="ChangedPropertyTestFixture"> | ||
<template> | ||
<deep-intersection-observer prop1="new-prop1"></deep-intersection-observer> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
suite('deep-intersection-observer', () => { | ||
|
||
test('instantiating the element with default properties works', () => { | ||
const element = fixture('BasicTestFixture'); | ||
assert.equal(element.prop1, 'deep-intersection-observer'); | ||
const elementShadowRoot = element.shadowRoot; | ||
const elementHeader = elementShadowRoot.querySelector('h2'); | ||
assert.equal(elementHeader.innerHTML, 'Hello deep-intersection-observer!'); | ||
}); | ||
|
||
test('setting a property on the element works', () => { | ||
// Create a test fixture | ||
const element = fixture('ChangedPropertyTestFixture'); | ||
assert.equal(element.prop1, 'new-prop1'); | ||
const elementShadowRoot = element.shadowRoot; | ||
const elementHeader = elementShadowRoot.querySelector('h2'); | ||
assert.equal(elementHeader.innerHTML, 'Hello new-prop1!'); | ||
}); | ||
|
||
}); | ||
</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 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
// Load and run all tests (.html, .js): | ||
WCT.loadSuites([ | ||
'deep-intersection-observer_test.html' | ||
]); | ||
</script> | ||
|
||
</body></html> |