forked from marko-js/marko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
342a3e7
commit 68129e6
Showing
15 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/autotests/components-pages/empty-component/components/a/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class { | ||
onMount() { | ||
window.app = this; | ||
} | ||
} | ||
|
||
<b key="b"/> |
3 changes: 3 additions & 0 deletions
3
test/autotests/components-pages/empty-component/components/b/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class {} | ||
|
||
-- ${undefined} |
23 changes: 23 additions & 0 deletions
23
test/autotests/components-pages/empty-component/template.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
lasso-page dependencies=input.browserDependencies lasso=input.lasso | ||
|
||
<!DOCTYPE html> | ||
html lang="en" | ||
head | ||
meta charset="UTF-8" | ||
title -- Marko Test | ||
lasso-head | ||
body | ||
|
||
div id="test" | ||
div id="mocha" | ||
div id="testsTarget" | ||
|
||
lasso-body | ||
|
||
<a key="a"/> | ||
|
||
init-components immediate | ||
|
||
lasso-slot name="mocha-run" | ||
|
||
browser-refresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var path = require('path'); | ||
var expect = require('chai').expect; | ||
|
||
describe(path.basename(__dirname), function() { | ||
it('should allow diffing html', function() { | ||
var app = window.app; | ||
app.forceUpdate(); | ||
app.update(); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
test/autotests/components-pages/if-empty-component/components/a/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class { | ||
onMount() { | ||
window.app = this; | ||
} | ||
} | ||
|
||
<if(input.show)> | ||
<div.show/> | ||
</if> | ||
<else> | ||
<b key="b"/> | ||
</else> |
3 changes: 3 additions & 0 deletions
3
test/autotests/components-pages/if-empty-component/components/b/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class {} | ||
|
||
-- ${undefined} |
23 changes: 23 additions & 0 deletions
23
test/autotests/components-pages/if-empty-component/template.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
lasso-page dependencies=input.browserDependencies lasso=input.lasso | ||
|
||
<!DOCTYPE html> | ||
html lang="en" | ||
head | ||
meta charset="UTF-8" | ||
title -- Marko Test | ||
lasso-head | ||
body | ||
|
||
div id="test" | ||
div id="mocha" | ||
div id="testsTarget" | ||
|
||
lasso-body | ||
|
||
<a key="a"/> | ||
|
||
init-components immediate | ||
|
||
lasso-slot name="mocha-run" | ||
|
||
browser-refresh |
13 changes: 13 additions & 0 deletions
13
test/autotests/components-pages/if-empty-component/tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var path = require('path'); | ||
var expect = require('chai').expect; | ||
|
||
describe(path.basename(__dirname), function() { | ||
it('should allow diffing html', function() { | ||
var app = window.app; | ||
app.forceUpdate(); | ||
app.update(); | ||
app.input = { show: true }; | ||
app.forceUpdate(); | ||
app.update(); | ||
}); | ||
}); |
7 changes: 7 additions & 0 deletions
7
test/autotests/components-pages/nesting/components/a/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class { | ||
onMount() { | ||
window.app = this; | ||
} | ||
} | ||
|
||
<b model={} key="b"/> |
5 changes: 5 additions & 0 deletions
5
test/autotests/components-pages/nesting/components/b/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class { | ||
} | ||
|
||
<c key="c"/> |
5 changes: 5 additions & 0 deletions
5
test/autotests/components-pages/nesting/components/c/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class { | ||
} | ||
|
||
<d key="d1"/> | ||
<d key="d2"/> |
4 changes: 4 additions & 0 deletions
4
test/autotests/components-pages/nesting/components/d/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class { | ||
} | ||
|
||
<div.d/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
lasso-page dependencies=input.browserDependencies lasso=input.lasso | ||
|
||
<!DOCTYPE html> | ||
html lang="en" | ||
head | ||
meta charset="UTF-8" | ||
title -- Marko Test | ||
lasso-head | ||
body | ||
|
||
div id="test" | ||
div id="mocha" | ||
div id="testsTarget" | ||
|
||
lasso-body | ||
|
||
div id="test-result" | ||
a key="a" | ||
|
||
init-components immediate | ||
|
||
lasso-slot name="mocha-run" | ||
|
||
browser-refresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var path = require('path'); | ||
var expect = require('chai').expect; | ||
var Component = require('./components/a/index.marko'); | ||
|
||
describe(path.basename(__dirname), function() { | ||
it('should allow diffing html', function() { | ||
var parentNode = document.getElementById('test-result'); | ||
var app = window.app; | ||
app.forceUpdate(); | ||
app.update(); | ||
expect(app.getEl().parentNode).to.equal(parentNode); | ||
expect(parentNode.querySelectorAll('.d').length).to.equal(2); | ||
// Ensure it produces the same output as rendering in the browser. | ||
expect(Component.renderSync().toString(), parentNode.innerHTML) | ||
}); | ||
}); |