Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix polymer 3 #36

Open
wants to merge 1 commit into
base: 3.0-preview
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bower_components*
bower-*.json
node_modules
*.lock
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ sudo: required
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
chrome: beta
before_script:
- npm install -g polymer-cli
- polymer install --variants
- yarn
script:
- xvfb-run polymer test
- xvfb-run polymer test --npm
- >-
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then polymer test -s 'default';
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then polymer test --npm -s 'default';
fi
env:
global:
Expand Down
57 changes: 0 additions & 57 deletions bower.json

This file was deleted.

2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../../@webcomponents/webcomponentsjs/webcomponents-lite.js"></script>
<script type="module" src="../../paper-styles/demo-pages.js"></script>
<script type="module" src="./prism-demo.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<title>prism-element</title>

<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../@webcomponents/webcomponentsjs/webcomponents-lite.js"></script>
<script type="module" src="../iron-component-page/iron-component-page.js"></script>

</head>
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/PolymerElements/prism-highlighter",
"dependencies": {
"@polymer/polymer": "^3.0.0-pre.1"
"@polymer/polymer": "^3.0.0-pre.1",
"prismjs": "^1.6.0"
},
"devDependencies": {}
}
"devDependencies": {
"@polymer/paper-styles": "next",
"wct-browser-legacy": "^0.0.1-pre.3"
},
"resolutions": {
"type-detect": "1.0.0",
"supports-color": "3.1.2"
}
}
4 changes: 2 additions & 2 deletions prism-highlighter.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Base } from '../polymer/polymer.js';
import './prism-import.js';
import '../../prismjs/prism.js';
import { Polymer } from '../polymer/lib/legacy/polymer-fn.js';

var HIGHLIGHT_EVENT = 'syntax-highlight';

Polymer({

is: 'prism-highlighter',

properties: {
/**
* Adds languages outside of the core Prism languages.
Expand Down
1 change: 0 additions & 1 deletion prism-import.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../web-component-tester/browser.js"></script>
<script src="../../../wct-browser-legacy/browser.js"></script>
</head>
<body>
<script>
Expand Down
23 changes: 12 additions & 11 deletions test/prism-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<meta charset="UTF-8">
<title>prism-element basic tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../../@webcomponents/webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../../wct-browser-legacy/browser.js"></script>
<script type="module" src="../../test-fixture/test-fixture.js"></script>
<script type="module" src="../prism-highlighter.js"></script>
<script type="module" src="./simple-container.js"></script>
</head>
Expand Down Expand Up @@ -59,7 +60,7 @@
lang: 'markup'
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.calledWithExactly('<foo>', Prism.languages.markup))
.to.equal(true);
Expand All @@ -70,14 +71,14 @@

sinon.spy(console, 'warn');

el.fire('syntax-highlight');
el.dispatchEvent(new CustomEvent('syntax-highlight'));

expect(console.warn.callCount).to.equal(1);

ev = {
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(console.warn.callCount).to.equal(2);
expect(ev.code).to.equal(undefined);
Expand All @@ -90,7 +91,7 @@

el = fixture('double-highlight');

el.querySelector('#container-1').fire('syntax-highlight', ev);
el.querySelector('#container-1').dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.callCount).to.equal(1);
});
Expand All @@ -101,7 +102,7 @@
code: '<foo>'
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.calledWithExactly('<foo>', Prism.languages.markup))
.to.equal(true);
Expand All @@ -112,7 +113,7 @@
code: 'return;'
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.calledWithExactly('return;', Prism.languages.javascript))
.to.equal(true);
Expand All @@ -126,7 +127,7 @@
lang: 'js'
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.calledWithExactly('return;', Prism.languages.javascript))
.to.equal(true);
Expand All @@ -138,7 +139,7 @@
lang: 'es'
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.calledWithExactly('return;', Prism.languages.javascript))
.to.equal(true);
Expand All @@ -150,7 +151,7 @@
lang: 'c'
};

el.fire('syntax-highlight', ev);
el.dispatchEvent(new CustomEvent('syntax-highlight', {detail: ev}));

expect(Prism.highlight.calledWithExactly('return;', Prism.languages.clike))
.to.equal(true);
Expand Down
7 changes: 2 additions & 5 deletions test/simple-container.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
import '../../polymer/polymer.js';
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js';
Polymer({
is: 'simple-container'
});
export class SimpleContainer extends HTMLElement {}
customElements.define('simple-container', SimpleContainer);