Skip to content

Commit

Permalink
fix: Move to BrightspaceUI org and update name to fix publishing (#68)
Browse files Browse the repository at this point in the history
* Move to BrightspaceUI org and update name to fix publishing
* Fine, I'll upgrade the tests
  • Loading branch information
svanherk authored Jun 2, 2022
1 parent 44d6bf1 commit 19b5fba
Show file tree
Hide file tree
Showing 23 changed files with 613 additions and 975 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm install
run: |
npm install
npm install @web/test-runner-playwright --no-save
npx playwright install-deps
- name: Lint
run: npm run test:lint
- name: Polymer Tests (SauceLabs)
env:
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY_DESIRE2LEARN }}
SAUCE_USERNAME: Desire2Learn
run: npm run test:polymer:sauce
- name: Unit Tests
run: npx web-test-runner --config web-test-runner.config.js --group default --playwright --browsers chromium firefox webkit
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
16
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @dbatiste @dlockhart
* @BrightspaceUI/gaudi-dev
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# d2l-polymer-behaviors
# @brightspace-ui/polymer-behaviors

Shared [Polymer](https://www.polymer-project.org/1.0/)-based behaviors and modules for implementing and consuming web components.

Expand All @@ -7,7 +7,7 @@ Shared [Polymer](https://www.polymer-project.org/1.0/)-based behaviors and modul
Install from NPM:

```shell
npm install d2l-polymer-behaviors
npm install @brightspace-ui/polymer-behaviors
```

## Usage
Expand Down
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
{
"description": "Shared Polymer behaviors for use in web components",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/Brightspace/d2l-polymer-behaviors-ui.git"
"url": "https://github.com/BrightspaceUI/d2l-polymer-behaviors-ui.git"
},
"name": "d2l-polymer-behaviors",
"name": "@brightspace-ui/polymer-behaviors",
"scripts": {
"test:lint": "npm run test:lint:wc && npm run test:lint:js",
"test:lint:js": "eslint . --ext .js,.html test/**/*.js test/**/*.html demo/**/*.js demo/**/*.html",
"test:lint:wc": "polymer lint",
"test:polymer:local": "polymer test --skip-plugin sauce",
"test:polymer:sauce": "polymer test --skip-plugin local",
"test": "npm run test:lint && npm run test:polymer:local"
"start": "web-dev-server --node-resolve --watch",
"test": "npm run test:lint && npm run test:headless",
"test:headless": "web-test-runner --group default",
"test:headless:watch": "web-test-runner --group default --watch",
"test:lint": "npm run test:lint:js",
"test:lint:js": "eslint . --ext .js,.html test/**/*.js demo/**/*.js demo/**/*.html"
},
"author": "D2L Corporation",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7",
"@babel/eslint-parser": "^7",
"@polymer/iron-test-helpers": "^3.0.0",
"@open-wc/testing": "^3",
"@web/dev-server": "^0.1",
"@web/test-runner": "^0.13",
"eslint": "^8",
"eslint-config-brightspace": "^0.16",
"eslint-plugin-html": "^6",
"eslint-plugin-import": "^2",
"eslint-plugin-lit": "^1",
"eslint-plugin-sort-class-members": "^1",
"polymer-cli": "^1.9.5",
"wct-browser-legacy": "^1.0.1"
"sinon": "^14"
},
"version": "3.1.0",
"files": [
Expand All @@ -40,6 +42,9 @@
"d2l-visible-on-ancestor-behavior.js",
"requestIdleCallback.js"
],
"publishConfig": {
"access": "public"
},
"dependencies": {
"@brightspace-ui/core": "^2",
"@polymer/polymer": "^3.0.0",
Expand Down
8 changes: 0 additions & 8 deletions polymer.json

This file was deleted.

2 changes: 1 addition & 1 deletion test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "brightspace/wct-polymer-3-config"
"extends": "brightspace/open-wc-testing-config"
}
122 changes: 0 additions & 122 deletions test/dom-expand-collapse.html

This file was deleted.

79 changes: 79 additions & 0 deletions test/dom-expand-collapse.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import '../d2l-dom-expand-collapse.js';
import { expect, fixture, html } from '@open-wc/testing';

describe('d2l-dom-expand-collapse', () => {
describe('collapse', () => {
let collapseFixture;

beforeEach(async() => {
collapseFixture = await fixture(html`<div>Some content.</div>`);
});

it('returns rejected promise if node not specified', (done) => {
D2L.Dom.ExpandCollapse.collapse()
.catch(() => {
done();
});
});

it('collapses element', async() => {
await D2L.Dom.ExpandCollapse.collapse(collapseFixture);

expect(collapseFixture.getBoundingClientRect().height).to.equal(0);
expect(collapseFixture.offsetParent).to.equal(null);
});

it('restores existing style properties', async() => {
collapseFixture.style.display = 'inline-block';
collapseFixture.style.height = '500px';
collapseFixture.style.overflow = 'visible';
collapseFixture.style.transition = 'transform 2s ease-out';
await D2L.Dom.ExpandCollapse.collapse(collapseFixture);
await D2L.Dom.ExpandCollapse.expand(collapseFixture);

expect(collapseFixture.style.display).to.equal('inline-block');
expect(collapseFixture.style.height).to.equal('500px');
expect(collapseFixture.style.overflow).to.equal('visible');
const isExpectedTransition = (collapseFixture.style.transition === 'transform 2s ease-out 0s' || collapseFixture.style.transition === 'transform 2s ease-out');
expect(isExpectedTransition).to.equal(true);
expect(collapseFixture.getAttribute('data-d2l-ec-display')).to.equal(null);
expect(collapseFixture.getAttribute('data-d2l-ec-height')).to.equal(null);
expect(collapseFixture.getAttribute('data-d2l-ec-overflow')).to.equal(null);
expect(collapseFixture.getAttribute('data-d2l-ec-transition')).to.equal(null);
});

});

describe('expand', () => {
let expandFixture;

beforeEach(async() => {
expandFixture = await fixture(html`<div style="height: 0; overflow: hidden; display: none;">Some content.</div>`);
});

it('returns rejected promise if node not specified', (done) => {
D2L.Dom.ExpandCollapse.expand()
.catch(() => {
done();
});
});

it('expands element', async() => {
await D2L.Dom.ExpandCollapse.expand(expandFixture);

expect(expandFixture.getBoundingClientRect().height).not.to.equal(0);
expect(expandFixture.offsetParent).not.to.equal(null);
});

it('removes d2l-hidden if present', async() => {
expandFixture.classList.add('d2l-hidden');
await D2L.Dom.ExpandCollapse.expand(expandFixture);

expect(expandFixture.getBoundingClientRect().height).not.to.equal(0);
expect(expandFixture.classList.contains('d2l-hidden')).to.equal(false);
expect(expandFixture.offsetParent).not.to.equal(null);
});

});

});
Loading

0 comments on commit 19b5fba

Please sign in to comment.