Skip to content

Commit

Permalink
minor describe block refactoring for jsx spec
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Dec 30, 2022
1 parent 6b4ac71 commit 14bfdc2
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions test/cases/jsx/jsx.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
* badge.jsx
* counter.jsx
*/

import chai from 'chai';
import { JSDOM } from 'jsdom';
import { renderToString } from '../../../src/wcc.js';

const expect = chai.expect;

describe('Run WCC For ', function() {
const LABEL = 'Single Custom Element using JSX and Declarative Shadow DOM';
const LABEL = 'Single Custom Element using JSX';
let dom;
let meta;

Expand All @@ -31,7 +30,7 @@ describe('Run WCC For ', function() {

describe(LABEL, function() {

describe('<Counter> component', function() {
describe('<Counter> component w/ <Badge>', function() {
let buttons;

before(async function() {
Expand All @@ -56,21 +55,21 @@ describe('Run WCC For ', function() {
expect(span.getAttribute('class')).to.be.equal('unmet');
expect(span.textContent).to.be.equal('0');
});
});

describe('Event Handling', () => {
// <button onclick={this.decrement}> - </button>
it('should handle a this expression', () => {
const element = Array.from(buttons).find(button => button.getAttribute('id') === 'evt-this');
describe('Event Handling', () => {
// <button onclick={this.decrement}> - </button>
it('should handle a this expression', () => {
const element = Array.from(buttons).find(button => button.getAttribute('id') === 'evt-this');

expect(element.getAttribute('onclick')).to.be.equal('this.parentElement.parentElement.decrement()');
});

expect(element.getAttribute('onclick')).to.be.equal('this.parentElement.parentElement.decrement()');
});

// <button onclick={this.count -= 1}> - </button>
it('should handle an assignment expression with implicit reactivity using this.render', () => {
const element = Array.from(buttons).find(button => button.getAttribute('id') === 'evt-assignment');
// <button onclick={this.count -= 1}> - </button>
it('should handle an assignment expression with implicit reactivity using this.render', () => {
const element = Array.from(buttons).find(button => button.getAttribute('id') === 'evt-assignment');

expect(element.getAttribute('onclick')).to.be.equal('this.parentElement.parentElement.count-=1; this.parentElement.parentElement.render();');
});
expect(element.getAttribute('onclick')).to.be.equal('this.parentElement.parentElement.count-=1; this.parentElement.parentElement.render();');
});
});

Expand Down

0 comments on commit 14bfdc2

Please sign in to comment.