-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into users/chhol/remove-hypertext-styles-from-b…
…utton
- Loading branch information
Showing
26 changed files
with
2,469 additions
and
389 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,52 @@ | ||
name: CD - FAST | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build_deploy_linux: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
AZURE_WEBAPP_ACTIVE_STAGE_NAME: www-west-app | ||
AZURE_WEBAPP_PASSIVE_STAGE_NAME: www-east-app | ||
AZURE_WEBAPP_BUILD_PATH: sites/website | ||
AZURE_WEBAPP_DIST_PATH: sites/website/static | ||
AZURE_WEBAPP_SLOT_NAME: stage | ||
|
||
steps: | ||
- name: Checkout Branch | ||
uses: actions/checkout@master | ||
|
||
- name: Install Lerna | ||
run: yarn global add lerna | ||
|
||
- name: Install package dependencies / prepare workspaces | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build & Prepare Web Application | ||
run: | | ||
cd ${{ env.AZURE_WEBAPP_BUILD_PATH }} | ||
npm i | ||
yarn build | ||
cp ../site-utilities/statics/server/package.json ../site-utilities/statics/server/server.js static | ||
cd static | ||
npm i | ||
ls -lta | ||
- name: 'Deploy to Active Azure Region' | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE_WWW_ACTIVE }} | ||
app-name: ${{ env.AZURE_WEBAPP_ACTIVE_STAGE_NAME }} | ||
package: ${{ env.AZURE_WEBAPP_DIST_PATH }} | ||
slot-name: ${{ env.AZURE_WEBAPP_SLOT_NAME }} | ||
|
||
- name: 'Deploy to Passive Azure Region' | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE_WWW_PASSIVE }} | ||
app-name: ${{ env.AZURE_WEBAPP_PASSIVE_STAGE_NAME }} | ||
package: ${{ env.AZURE_WEBAPP_DIST_PATH }} | ||
slot-name: ${{ env.AZURE_WEBAPP_SLOT_NAME }} |
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
139 changes: 139 additions & 0 deletions
139
packages/web-components/fast-element/src/directives/children.spec.ts
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,139 @@ | ||
import { expect } from "chai"; | ||
import { children, ChildrenBehavior } from "./children"; | ||
import { AttachedBehaviorDirective } from "./directive"; | ||
import { observable } from "../observation/observable"; | ||
import { elements } from "./node-observation"; | ||
import { DOM } from "../dom"; | ||
|
||
describe("The children", () => { | ||
context("template function", () => { | ||
it("returns an AttachedBehaviorDirective", () => { | ||
const directive = children("test"); | ||
expect(directive).to.be.instanceOf(AttachedBehaviorDirective); | ||
}); | ||
}); | ||
|
||
context("directive", () => { | ||
it("creates a ChildrenBehavior", () => { | ||
const directive = children("test") as AttachedBehaviorDirective; | ||
const target = document.createElement("div"); | ||
const behavior = directive.createBehavior(target); | ||
|
||
expect(behavior).to.be.instanceOf(ChildrenBehavior); | ||
}); | ||
}); | ||
|
||
context("behavior", () => { | ||
class Model { | ||
@observable nodes; | ||
} | ||
|
||
function createAndAppendChildren(host: HTMLElement, elementName = "div") { | ||
const children = new Array(10); | ||
|
||
for (let i = 0, ii = children.length; i < ii; ++i) { | ||
const child = document.createElement(i % 1 === 0 ? elementName : "div"); | ||
children[i] = child; | ||
host.appendChild(child); | ||
} | ||
|
||
return children; | ||
} | ||
|
||
function createDOM(elementName: string = "div") { | ||
const host = document.createElement("div"); | ||
const children = createAndAppendChildren(host, elementName); | ||
|
||
return { host, children }; | ||
} | ||
|
||
it("gathers child nodes", () => { | ||
const { host, children } = createDOM(); | ||
const behavior = new ChildrenBehavior(host, { | ||
property: "nodes", | ||
childList: true, | ||
}); | ||
const model = new Model(); | ||
|
||
behavior.bind(model); | ||
|
||
expect(model.nodes).members(children); | ||
}); | ||
|
||
it("gathers child nodes with a filter", () => { | ||
const { host, children } = createDOM("foo-bar"); | ||
const behavior = new ChildrenBehavior(host, { | ||
property: "nodes", | ||
childList: true, | ||
filter: elements("foo-bar"), | ||
}); | ||
const model = new Model(); | ||
|
||
behavior.bind(model); | ||
|
||
expect(model.nodes).members(children.filter(elements("foo-bar"))); | ||
}); | ||
|
||
it("updates child nodes when they change", async () => { | ||
const { host, children } = createDOM("foo-bar"); | ||
const behavior = new ChildrenBehavior(host, { | ||
property: "nodes", | ||
childList: true, | ||
}); | ||
const model = new Model(); | ||
|
||
behavior.bind(model); | ||
|
||
expect(model.nodes).members(children); | ||
|
||
const updatedChildren = children.concat(createAndAppendChildren(host)); | ||
|
||
await DOM.nextUpdate(); | ||
|
||
expect(model.nodes).members(updatedChildren); | ||
}); | ||
|
||
it("updates child nodes when they change with a filter", async () => { | ||
const { host, children } = createDOM("foo-bar"); | ||
const behavior = new ChildrenBehavior(host, { | ||
property: "nodes", | ||
childList: true, | ||
filter: elements("foo-bar"), | ||
}); | ||
const model = new Model(); | ||
|
||
behavior.bind(model); | ||
|
||
expect(model.nodes).members(children); | ||
|
||
const updatedChildren = children.concat(createAndAppendChildren(host)); | ||
|
||
await DOM.nextUpdate(); | ||
|
||
expect(model.nodes).members(updatedChildren.filter(elements("foo-bar"))); | ||
}); | ||
|
||
it("clears and unwatches when unbound", async () => { | ||
const { host, children } = createDOM("foo-bar"); | ||
const behavior = new ChildrenBehavior(host, { | ||
property: "nodes", | ||
childList: true, | ||
}); | ||
const model = new Model(); | ||
|
||
behavior.bind(model); | ||
|
||
expect(model.nodes).members(children); | ||
|
||
behavior.unbind(); | ||
|
||
expect(model.nodes).members([]); | ||
|
||
host.appendChild(document.createElement("div")); | ||
|
||
await DOM.nextUpdate(); | ||
|
||
expect(model.nodes).members([]); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.