File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < title > Custom Elements</ title >
5
+ < meta charset ="utf-8 ">
6
+ < script src ="../../../dist/seed.js "> </ script >
7
+ </ head >
8
+ < body >
9
+ < my-element > afsefsefse</ my-element >
10
+ < cool > hmm</ cool >
11
+ < wow > </ wow >
12
+ < script >
13
+ // global custom element with option object + replace
14
+ Seed . element ( 'my-element' , {
15
+ replace : true ,
16
+ className : 'test' ,
17
+ template : '<div>{{msg}}</div>'
18
+ } )
19
+ new Seed ( {
20
+ el :'body' ,
21
+ scope : {
22
+ msg : 'hihi' ,
23
+ } ,
24
+ elements : {
25
+ // private custom element with simple function
26
+ cool : function ( el ) {
27
+ el . className = 'cool'
28
+ el . innerHTML = 'This is cool'
29
+ } ,
30
+ // private custom element with constructor
31
+ wow : Seed . extend ( {
32
+ init : function ( ) {
33
+ this . $el . textContent = 'this is wow'
34
+ }
35
+ } )
36
+ }
37
+ } )
38
+ </ script >
39
+ </ body >
40
+ </ html >
Original file line number Diff line number Diff line change
1
+ casper . test . begin ( 'Custom Elements' , 3 , function ( test ) {
2
+
3
+ casper
4
+ . start ( './fixtures/custom-element.html' , function ( ) {
5
+ test . assertSelectorHasText ( 'div.test' , 'hihi' )
6
+ test . assertSelectorHasText ( 'cool.cool' , 'This is cool' )
7
+ test . assertSelectorHasText ( 'wow' , 'this is wow' )
8
+ } )
9
+ . run ( function ( ) {
10
+ test . done ( )
11
+ } )
12
+
13
+ } )
You can’t perform that action at this time.
0 commit comments