Skip to content

Commit

Permalink
Add more examples for pat-tree
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed Dec 2, 2020
1 parent f62530b commit e1876be
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
18 changes: 17 additions & 1 deletion src/pat/tree/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ title: Tree

Tree pattern.


## Configuration

| Option | Type | Default | Description |
Expand All @@ -21,6 +20,23 @@ Tree pattern.

### JSON node data

``` html
<div class="pat-tree"
data-pat-tree='data:[
{ "label": "node1",
"children": [
{ "label": "child1" },
{ "label": "child2" }
]
},
{ "label": "node2",
"children": [
{ "label": "child3" }
]
}
];'> </div>
```

<div class="pat-tree"
data-pat-tree='data:[
{ "label": "node1",
Expand Down
15 changes: 4 additions & 11 deletions src/pat/tree/tree.test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import $ from "jquery";
import Pattern from "./tree";
import utils from "../../core/utils";

// define(["expect", "jquery", "pat-registry", "mockup-patterns-tree"], function (
// expect,
// $,
// registry,
// Tree
// ) {
// "use strict";

// window.mocha.setup("bdd");
// $.fx.off = true;
$.fx.off = true;

describe("Tree", function () {

it("loads the tree with data", function () {
document.body.innerHTML = `
<div class="pat-tree"/>
<div class="pat-tree"></div>
`;
//await utils.timeout(1);
const el = document.querySelector(".pat-tree");
var tree = new Pattern(el, {
autoOpen: true,
Expand Down

0 comments on commit e1876be

Please sign in to comment.