-
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow referencing HTML elements and components in tests.
- Loading branch information
1 parent
02cbd3a
commit f8aeeed
Showing
13 changed files
with
188 additions
and
30 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
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,45 @@ | ||
type Maybe(a) { | ||
Nothing | ||
Just(a) | ||
} | ||
|
||
suite "Test" { | ||
test "X" { | ||
<button as button/> | ||
|
||
button == Maybe.Nothing | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
import { | ||
createElement as D, | ||
testRunner as B, | ||
createRef as C, | ||
compare as F, | ||
variant as A, | ||
setRef as E | ||
} from "./runtime.js"; | ||
|
||
export const | ||
G = A(0, `Maybe.Nothing`), | ||
H = A(1, `Maybe.Just`); | ||
|
||
export default () => { | ||
new B([{ | ||
tests: [{ | ||
proc: () => { | ||
const a = C(new G()); | ||
return (() => { | ||
D(`button`, { | ||
ref: E(a, H) | ||
}); | ||
return F(a.current, new G()) | ||
})() | ||
}, | ||
location: {"start":[7,2],"end":[11,3],"filename":"compilers/test_with_reference"}, | ||
name: `X` | ||
}], | ||
location: {"start":[6,0],"end":[12,1],"filename":"compilers/test_with_reference"}, | ||
name: `Test` | ||
}], {}, ``, ``) | ||
}; |
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,61 @@ | ||
type Maybe(a) { | ||
Nothing | ||
Just(a) | ||
} | ||
|
||
component Button { | ||
fun render : Html { | ||
<div/> | ||
} | ||
} | ||
|
||
suite "Test" { | ||
test "X" { | ||
<Button as button/> | ||
|
||
button == Maybe.Nothing | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
import { | ||
createElement as C, | ||
testRunner as D, | ||
createRef as E, | ||
compare as G, | ||
useMemo as B, | ||
variant as A, | ||
setRef as F | ||
} from "./runtime.js"; | ||
|
||
export const | ||
H = A(0, `Maybe.Nothing`), | ||
I = A(1, `Maybe.Just`), | ||
J = ({ | ||
_ | ||
}) => { | ||
const a = B(() => { | ||
return {} | ||
}, []); | ||
(_ ? _(a) : null); | ||
return C(`div`, {}) | ||
}; | ||
|
||
export default () => { | ||
new D([{ | ||
tests: [{ | ||
proc: () => { | ||
const b = E(new H()); | ||
return (() => { | ||
C(J, { | ||
_: F(b, I) | ||
}); | ||
return G(b.current, new H()) | ||
})() | ||
}, | ||
location: {"start":[13,2],"end":[17,3],"filename":"compilers/test_with_reference_component"}, | ||
name: `X` | ||
}], | ||
location: {"start":[12,0],"end":[18,1],"filename":"compilers/test_with_reference_component"}, | ||
name: `Test` | ||
}], {}, ``, ``) | ||
}; |
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
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
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
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
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
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
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
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
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
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