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

migrate tests to @open-wc/testing #281

Open
wants to merge 9 commits into
base: main
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
286 changes: 143 additions & 143 deletions apps/tutorial/application.css

Large diffs are not rendered by default.

2,214 changes: 872 additions & 1,342 deletions apps/tutorial/application.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/tutorial/application.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions apps/tutorial/serviceworker.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions apps/tutorial/serviceworker.js.map

Large diffs are not rendered by default.

286 changes: 143 additions & 143 deletions docs/application.css

Large diffs are not rendered by default.

2,214 changes: 872 additions & 1,342 deletions docs/application.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/application.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/serviceworker.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/serviceworker.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/elements/css/bloch_display.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ bloch-display {
@apply bg-green-50;
}

&[data-grabbed]::part(sphere-border) {
&[data-draggable-grabbed]::part(sphere-border) {
@apply border-purple-500;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/elements/css/control_gate.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ control-gate {
color: var(--qni-semantic-fill-color-primary);
}

&[data-disabled]:not([data-grabbed])::part(icon) {
&[data-disabled]:not([data-draggable-grabbed])::part(icon) {
color: var(--qni-semantic-fill-color-disabled);
}
}
12 changes: 6 additions & 6 deletions packages/elements/css/measurement_gate.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ measurement-gate {
color: var(--qni-semantic-color-intermediate);
}

circuit-dropzone &[data-snapped]::part(icon) {
circuit-dropzone &[data-draggable-snapped]::part(icon) {
@apply origin-center transform-gpu;
@apply rotate-90 sm:rotate-0;
}
Expand All @@ -27,7 +27,7 @@ measurement-gate {
@apply absolute inset-0;
}

circuit-dropzone &[data-snapped]::part(value) {
circuit-dropzone &[data-draggable-snapped]::part(value) {
@apply origin-center transform-gpu;
@apply rotate-90 sm:rotate-0;
}
Expand All @@ -51,17 +51,17 @@ measurement-gate {
content: '1';
}

/* data-grabbed */
/* data-draggable-grabbed */

&[data-grabbed]::part(body) {
&[data-draggable-grabbed]::part(body) {
background-color: var(--qni-semantic-fill-color-intermediate);
}

&[data-grabbed]::part(icon) {
&[data-draggable-grabbed]::part(icon) {
@apply text-purple-400;
}

&[data-grabbed]::part(value)::after {
&[data-draggable-grabbed]::part(value)::after {
@apply text-white;
}
}
18 changes: 9 additions & 9 deletions packages/elements/css/qni.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}

.qpu-operation-hoverable {
palette-dropzone &[data-hoverable]:not([data-grabbed]):hover::part(outline),
palette-dropzone &[data-hoverable]:not([data-draggable-grabbed]):hover::part(outline),
quantum-circuit:not([data-editing]) &[data-hoverable]:not([data-active]):not([data-resizing]):hover::part(outline) {
@apply block;
outline: var(--qni-semantic-border-width-outline) solid var(--qni-semantic-border-color-hover);
Expand All @@ -113,26 +113,26 @@
}
}

/* data-grabbed */
/* data-draggable-grabbed */

.qpu-operation-grabbable {
&[data-grabbed] {
&[data-draggable-grabbed] {
@apply cursor-grabbing;
}

&[data-grabbed]:not([data-snapped]) {
&[data-draggable-grabbed]:not([data-draggable-snapped]) {
@apply z-40;
}

&[data-grabbed]::part(body) {
&[data-draggable-grabbed]::part(body) {
background-color: var(--qni-semantic-fill-color-intermediate);
}

&[data-grabbed]::part(icon) {
&[data-draggable-grabbed]::part(icon) {
color: var(--qni-semantic-color-icon-inverse);
}

&[data-grabbed]::part(outline) {
&[data-draggable-grabbed]::part(outline) {
@apply hidden;
}
}
Expand Down Expand Up @@ -486,7 +486,7 @@
* - on palette
* - while dragging
*/
quantum-circuit:not([data-editing]) circuit-dropzone &:not([data-grabbed]):hover::part(resize-handle),
quantum-circuit:not([data-editing]) circuit-dropzone &:not([data-draggable-grabbed]):hover::part(resize-handle),
&[data-resizing]::part(resize-handle) {
@apply visible;
}
Expand Down Expand Up @@ -515,7 +515,7 @@
}

/* show trash icon */
circuit-dropzone &:not([data-snapped])::part(icon)::before {
circuit-dropzone &:not([data-draggable-snapped])::part(icon)::before {
@apply absolute -top-2.5 -right-2.5;
@apply h-6 w-6;
@apply z-10;
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/css/swap_gate.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ swap-gate {
color: var(--qni-semantic-fill-color-primary);
}

&[data-disabled]:not([data-grabbed])::part(icon) {
&[data-disabled]:not([data-draggable-grabbed])::part(icon) {
color: var(--qni-semantic-fill-color-disabled);
}
}
12 changes: 6 additions & 6 deletions packages/elements/css/write_gate.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ write-gate {
@apply text-zinc-200;
}

circuit-dropzone &[data-snapped]::part(icon) {
circuit-dropzone &[data-draggable-snapped]::part(icon) {
@apply origin-center transform-gpu;
@apply rotate-90 sm:rotate-0;
}
Expand All @@ -25,7 +25,7 @@ write-gate {
@apply absolute inset-0;
}

circuit-dropzone &[data-snapped]::part(value) {
circuit-dropzone &[data-draggable-snapped]::part(value) {
@apply origin-center transform-gpu;
@apply rotate-90 sm:rotate-0;
}
Expand Down Expand Up @@ -71,17 +71,17 @@ write-gate {
@apply text-4xl;
}

/* data-grabbed */
/* data-draggable-grabbed */

&[data-grabbed]::part(icon) {
&[data-draggable-grabbed]::part(icon) {
@apply text-purple-400;
}

&[data-grabbed][data-value='0']::part(value)::after {
&[data-draggable-grabbed][data-value='0']::part(value)::after {
@apply text-white;
}

&[data-grabbed][data-value='1']::part(value)::after {
&[data-draggable-grabbed][data-value='1']::part(value)::after {
@apply text-white;
}
}
2 changes: 2 additions & 0 deletions packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
"@github/prettier-config": "^0.0.4",
"@open-wc/testing": "^3.1.6",
"@rollup/plugin-commonjs": "^18",
"@rollup/plugin-replace": "^3.0.1",
"@size-limit/preset-small-lib": "^7.0.8",
"@web/dev-server-esbuild": "^0.3.2",
"@web/dev-server-rollup": "^0.3.14",
"@web/test-runner": "^0.13.25",
"autoprefixer": "^10.4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/src/circuit-dropzone-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class CircuitDropzoneElement extends HTMLElement {
initOperation: () => {
Util.notNull(this.operation)

this.operation.snapped = true
this.operation.snap()
},
snapOperation: () => {
Util.notNull(this.operation)
Expand All @@ -124,7 +124,7 @@ export class CircuitDropzoneElement extends HTMLElement {
this.append(event.operation)
this.operationName = event.operation.tagName.toLocaleLowerCase()
this.occupied = true
event.operation.snapped = true
event.operation.snap()
},
deleteOperation: (_context, event) => {
if (event.type !== 'DELETE_OPERATION') return
Expand Down
8 changes: 4 additions & 4 deletions packages/elements/src/circuit-editor-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class CircuitEditorElement extends HTMLElement {
const operation = event.operation
const snapTarget = this.circuit.snapTargetAt(event.x, event.y)

operation.snapped = true
operation.snap()

if (snapTarget.dropzone === null) {
const stepIndex = snapTarget.stepIndex
Expand Down Expand Up @@ -314,7 +314,7 @@ export class CircuitEditorElement extends HTMLElement {
if (event.type !== 'END_DRAGGING_OPERATION') return

const operation = event.operation
if (operation.snapped) return
if (operation.isSnapped) return

if (this.inspectorButton === undefined) return
if (!this.inspectorButton.isInspectorShown) return
Expand Down Expand Up @@ -428,7 +428,7 @@ export class CircuitEditorElement extends HTMLElement {
const el = event.target

if (isDraggable(el)) {
el.draggable = true
el.enableDrag()
} else {
throw new DetailedError('Not a draggable element.', {el})
}
Expand Down Expand Up @@ -471,7 +471,7 @@ export class CircuitEditorElement extends HTMLElement {
!this.inspectorButton.popup.reference.contains(clickedEl) &&
this.activeOperation !== null
) {
this.activeOperation.active = false
this.activeOperation.deactivate()
}
}

Expand Down
Loading