Skip to content

Commit

Permalink
test: verify attribute access
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Dec 21, 2022
1 parent befb7b0 commit 2527a94
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions test/spec/moddle.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,23 @@ describe('moddle', function() {

describe('typed', function() {

it('should access property', function() {
it('should access basic', function() {

// when
const element = moddle.create('props:ComplexCount', {
count: 10
});

// then
expect(element.get('count')).to.eql(10);
expect(element.get('props:count')).to.eql(10);

// available under base name
expect(element.count).to.exist;
});


it('should access refined property, created via base name', function() {

// when
const element = moddle.create('ext:ExtendedComplex', {
Expand All @@ -339,10 +355,14 @@ describe('moddle', function() {
expect(element.get('ext:numCount')).to.eql(10);
expect(element.get('count')).to.eql(10);
expect(element.get('props:count')).to.eql(10);

// available under refined name
expect(element.numCount).to.eql(10);
expect(element.count).not.to.exist;
});


it('should access refined property', function() {
it('should access refined property, created via refined name', function() {

// when
const element = moddle.create('ext:ExtendedComplex', {
Expand All @@ -354,6 +374,10 @@ describe('moddle', function() {
expect(element.get('ext:numCount')).to.eql(10);
expect(element.get('count')).to.eql(10);
expect(element.get('props:count')).to.eql(10);

// available under refined name
expect(element.numCount).to.eql(10);
expect(element.count).not.to.exist;
});


Expand Down

0 comments on commit 2527a94

Please sign in to comment.