Skip to content

Commit

Permalink
fix: added tests and updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed.alatawi committed Jul 20, 2020
1 parent 947cb6a commit db90913
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cache:
directories:
- $HOME/.npm
script:
- npm run test-lib-ci
- npm run build-lib && npm run build

notifications:
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ Add required dependencies to `angular.json` as follows:

See full example [here](https://github.com/AhmedAlatawi/ngx-treant-js/blob/master/angular.json).

### :pencil2: Key Goals
* Easy to integrate and use in any `Angular` applications
* Provide `callback` functions to react to user's actions, e.g. single-click, double-click, drag-drop, hover, etc
* provide `drag-drop` feature for swapping (re-positioning) `Tree` nodes
* Support adding & removing `Tree` nodes
* Support editting `Node`'s content, e.g. `name`, `title`, etc

### Quick start :rocket:
`employess-chart.component.html`
```html
Expand Down Expand Up @@ -135,6 +142,9 @@ See full example [here](https://github.com/fperucic/treant-js/tree/master/exampl
</ngx-treant-chart>
```

### Bootstrap Popover Example
![](./images/chart_with_popover_example.gif)


### :page_facing_up: NgxTreantChart component API

Expand Down
Binary file added images/chart_with_popover_example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions projects/ahmed757/ngx-treant-js/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ module.exports = function (config) {
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
},
singleRun: false,
restartOnFileChange: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NgxTreantJsComponent } from './ngx-treant-js.component';
import { Treant } from 'treant-js';
import * as raphael from '../../../../../node_modules/treant-js/vendor/raphael';
import * as jquery from 'jquery';
import { By } from '@angular/platform-browser';

(<any>window).Treant = Treant;
(<any>window).$ = jquery;
Expand Down Expand Up @@ -34,28 +35,50 @@ describe('NgxTreantJsComponent', () => {
connectors: {
type: 'step',
style: {
'stroke-width': 2,
},
'stroke-width': 2
}
},
node: {
HTMLclass: 'big-commpany',
},
HTMLclass: 'test-chart-class'
}
},
nodeStructure: {
text: { name: 'CEO' },
connectors: {
style: {
stroke: '#bbb',
'arrow-end': 'oval-wide-long',
className: 'test',
},
className: 'test'
}
},
},
children: [
{
text: { name: 'Account' },
stackChildren: true,
connectors: {
style: {
stroke: '#8080FF',
'arrow-end': 'block-wide-long',
},
},
children: [
{
text: { name: 'Receptionist' },
HTMLclass: 'reception',
},
{
text: { name: 'Author' }
}
]
}
]
}
};
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
it('Tree should be loaded', () => {
const chart = fixture.debugElement.query(By.css('.test-chart-class')).nativeElement;
expect(chart.id).toBe('test-chart-id');
});
});

0 comments on commit db90913

Please sign in to comment.