Browse Source

Pragmas in .js files.

Herby Vojčík 5 years ago
parent
commit
55121c8c8a
2 changed files with 21 additions and 0 deletions
  1. 9 0
      src/Silk-Tests.js
  2. 12 0
      src/Silk.js

+ 9 - 0
src/Silk-Tests.js

@@ -23,6 +23,7 @@ args: [],
 source: "testedClass\x0a\x09^ Silk",
 referencedClasses: ["Silk"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: []
 }),
 $globals.SilkInheritedTest);
@@ -67,6 +68,7 @@ args: ["aString"],
 source: "assertBodyEndsWith: aString\x0a\x09| sanitizedBody sanitizedAssertion |\x0a\x09sanitizedBody := document body innerHTML replace: '\x5cs*' with: ''.\x0a\x09sanitizedAssertion := aString replace: '\x5cs*' with: ''.\x0a\x09self assert: sanitizedBody size >= sanitizedAssertion size.\x0a\x09self\x0a\x09\x09assert: (sanitizedBody last: sanitizedAssertion size)\x0a\x09\x09equals: sanitizedAssertion",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["replace:with:", "innerHTML", "body", "assert:", ">=", "size", "assert:equals:", "last:"]
 }),
 $globals.SilkTest);
@@ -140,6 +142,7 @@ args: ["aStringArray"],
 source: "assertBodyEndsWithOneOf: aStringArray\x0a\x09| sanitizedBody err |\x0a\x09sanitizedBody := document body innerHTML replace: '\x5cs*' with: ''.\x0a\x09aStringArray do: [ :aString |\x0a\x09\x09| sanitizedAssertion |\x0a\x09\x09sanitizedAssertion := aString replace: '\x5cs*' with: ''.\x0a\x09\x09[ self\x0a\x09\x09\x09assert: sanitizedBody size >= sanitizedAssertion size;\x0a\x09\x09\x09assert: (sanitizedBody last: sanitizedAssertion size)\x0a\x09\x09\x09equals: sanitizedAssertion. ^ self ] on: Error do: [ :e | err := e ]].\x0a\x09err ifNotNil: [ err signal ]",
 referencedClasses: ["Error"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["replace:with:", "innerHTML", "body", "do:", "on:do:", "assert:", ">=", "size", "assert:equals:", "last:", "ifNotNil:", "signal"]
 }),
 $globals.SilkTest);
@@ -167,6 +170,7 @@ args: [],
 source: "setUp\x0a\x09fixtureDiv := document createElement: 'div'.\x0a\x09document body appendChild: fixtureDiv.\x0a\x09fixtureDiv setAttribute: 'id' to: 'fixture'.\x0a\x09fixtureDiv innerHTML: 'sentinel'",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["createElement:", "appendChild:", "body", "setAttribute:to:", "innerHTML:"]
 }),
 $globals.SilkTest);
@@ -199,6 +203,7 @@ args: [],
 source: "tearDown\x0a\x09| lastChild |\x0a\x09lastChild := document body lastChild.\x0a\x09self assert: lastChild equals: fixtureDiv.\x0a\x09document body removeChild: lastChild",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["lastChild", "body", "assert:equals:", "removeChild:"]
 }),
 $globals.SilkTest);
@@ -253,6 +258,7 @@ args: [],
 source: "testInsertTable\x0a\x0a\x09| d tbl  |\x0a\x0a\x09d := 'html body div#fixture' asSilk.\x0a\x0a\x09tbl := d TABLE.\x0a\x0a\x09tbl TR\x0a\x09\x09TD: 'A';\x0a\x09\x09TD: 'B';\x0a\x09\x09TD: 'C'.\x0a\x09\x0a\x09tbl TR\x0a\x09\x09TD: 'D';\x0a\x09\x09TD: 'E';\x0a\x09\x09TD: 'F'.\x0a\x09\x0a\x09self assertBodyEndsWith: '>sentinel<table><tr><td>A</td><td>B</td><td>C</td></tr><tr><td>D</td><td>E</td><td>F</td></tr></table></div>'",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["asSilk", "TABLE", "TD:", "TR", "assertBodyEndsWith:"]
 }),
 $globals.SilkTest);
@@ -309,6 +315,7 @@ args: [],
 source: "testInsertTable2\x0a\x0a\x09| d tbl  |\x0a\x0a\x09d := 'html body div#fixture' asSilk.\x0a\x0a\x09tbl := d TABLE.\x0a\x0a\x09tbl TR: {\x0a\x09\x09Silk TD: 'A'.\x0a\x09\x09Silk TD: 'B'.\x0a\x09\x09Silk TD: 'C'};\x0a\x09\x09TR: {\x0a\x09\x09Silk TD: 'D'.\x0a\x09\x09Silk TD: 'E'.\x0a\x09\x09Silk TD: 'F'}.\x0a\x09\x0a\x09self assertBodyEndsWith: '>sentinel<table><tr><td>A</td><td>B</td><td>C</td></tr><tr><td>D</td><td>E</td><td>F</td></tr></table></div>'",
 referencedClasses: ["Silk"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["asSilk", "TABLE", "TR:", "TD:", "assertBodyEndsWith:"]
 }),
 $globals.SilkTest);
@@ -391,6 +398,7 @@ args: [],
 source: "testNestedDIVsWithAttributes\x0a \x22demonstrates how DIVs are nested and given attributes\x22\x0a\x09| s |\x0a\x0a\x09s := '#fixture' asSilk.\x0a\x09\x0a\x09s := s DIV << ('id' -> 'container') << ('class' -> 'mySilkContainerClass').\x0a\x09s DIV << ('id' -> 'contentarea') << 'here comes the content'.\x0a\x09s := s DIV << ('id' -> 'toolbar') << ('class' -> 'myToolbarClass').\x0a\x09(s BUTTON: 'do something') on: 'click' bind: [Transcript show: 'button pressed'].\x0a\x09\x0a\x09self assertBodyEndsWithOneOf: #(\x0a\x09\x09'>sentinel<div class=\x22mySilkContainerClass\x22 id=\x22container\x22><div id=\x22contentarea\x22>here comes the content</div><div class=\x22myToolbarClass\x22 id=\x22toolbar\x22><button>do something</button></div></div></div>'\x0a\x09\x09'>sentinel<div id=\x22container\x22 class=\x22mySilkContainerClass\x22><div id=\x22contentarea\x22>here comes the content</div><div id=\x22toolbar\x22 class=\x22myToolbarClass\x22><button>do something</button></div></div></div>'\x0a\x09)",
 referencedClasses: ["Transcript"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["asSilk", "<<", "DIV", "->", "on:bind:", "BUTTON:", "show:", "assertBodyEndsWithOneOf:"]
 }),
 $globals.SilkTest);
@@ -436,6 +444,7 @@ args: [],
 source: "testOnClickEvent\x0a\x09\x22#on:bind\x22\x0a\x09\x0a\x09| s para |\x0a\x0a\x09s := '#fixture' asSilk.\x0a\x09para := s P: 'DOM'. \x0a\x0a\x09self timeout: 100.\x0a\x0a\x09(self async: [para on: 'click' bind:\x0a\x09\x09\x09[\x22Test successful\x22 self finished].\x0a\x0a\x09\x09'#fixture p' asJQuery trigger: 'click'.\x0a\x09\x09]) fork",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["asSilk", "P:", "timeout:", "fork", "async:", "on:bind:", "finished", "trigger:", "asJQuery"]
 }),
 $globals.SilkTest);

+ 12 - 0
src/Silk.js

@@ -45,6 +45,7 @@ args: ["aMessage"],
 source: "doesNotUnderstand: aMessage\x0a\x09\x22`aSilk DIV` creates a div element and inserts it.\x0a\x09`aSilk DIV: anObject` creates a div element, inserts it\x0a\x09and puts contents in it\x22\x0a\x09(self class tryMakeDnuElement: aMessage)\x0a\x09\x09ifNil: [ ^ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :newElement | self << newElement. ^ newElement ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["ifNil:ifNotNil:", "tryMakeDnuElement:", "class", "doesNotUnderstand:", "<<"]
 }),
 $globals.Silk);
@@ -82,6 +83,7 @@ args: ["anObject"],
 source: "nextPut: anObject\x0a\x09\x22Double-dispatches anObject via renderOnSilk: message.\x0a\x09If a message returns nil, this fallbacks to superclass.\x0a\x09Otherwise, it is assumed renderOnSilk: did its job.\x22\x0a\x0a\x09(anObject renderOnSilk: self)\x0a\x09\x09ifNil: [ super nextPut: anObject ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["ifNil:", "renderOnSilk:", "nextPut:"]
 }),
 $globals.Silk);
@@ -119,6 +121,7 @@ args: ["aMessage"],
 source: "doesNotUnderstand: aMessage\x0a\x09\x22`Silk DIV` creates a div element.\x0a\x09`Silk DIV: anObject` creates a div element and puts contents in it\x22\x0a\x09^ (self tryMakeDnuElement: aMessage)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["ifNil:", "tryMakeDnuElement:", "doesNotUnderstand:"]
 }),
 $globals.Silk.a$cls);
@@ -170,6 +173,7 @@ args: ["aMessage"],
 source: "tryMakeDnuElement: aMessage\x0a\x09\x22`DIV` creates a div element.\x0a\x09`DIV: anObject` creates a div element and puts contents in it\x22\x0a\x09| selector newElement useArg |\x0a\x09selector := aMessage selector.\x0a\x09selector asUppercase = selector\x0a\x09\x09ifFalse: [ ^ nil ].\x0a\x09selector last = ':'\x0a\x09\x09ifTrue: [ useArg := true. selector := selector allButLast ]\x0a\x09\x09ifFalse: [ useArg := false ].\x0a\x09(selector includes: ':')\x0a\x09\x09ifTrue: [ ^ nil ].\x0a\x09newElement := self newElement: selector asLowercase.\x0a\x09useArg ifTrue: [ newElement << aMessage arguments first ].\x0a\x09^ newElement",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["selector", "ifFalse:", "=", "asUppercase", "ifTrue:ifFalse:", "last", "allButLast", "ifTrue:", "includes:", "newElement:", "asLowercase", "<<", "first", "arguments"]
 }),
 $globals.Silk.a$cls);
@@ -194,6 +198,7 @@ args: ["aSilk"],
 source: "renderOnSilk: aSilk\x0a\x09key attrPut: value on: aSilk",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["attrPut:on:"]
 }),
 $globals.Association);
@@ -218,6 +223,7 @@ args: ["aSilk"],
 source: "renderOnSilk: aSilk\x0a\x09self value: aSilk",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["value:"]
 }),
 $globals.BlockClosure);
@@ -244,6 +250,7 @@ args: [],
 source: "inSilk\x0a\x09^ Silk newStream << self; yourself",
 referencedClasses: ["Silk"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["<<", "newStream", "yourself"]
 }),
 $globals.JSObjectProxy);
@@ -262,6 +269,7 @@ args: ["aSilk"],
 source: "renderOnSilk: aSilk\x0a\x09^ nil",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: []
 }),
 $globals.JSObjectProxy);
@@ -288,6 +296,7 @@ args: [],
 source: "inSilk\x0a\x09^ Silk newStream << self; yourself",
 referencedClasses: ["Silk"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["<<", "newStream", "yourself"]
 }),
 $globals.Object);
@@ -306,6 +315,7 @@ args: ["aSilk"],
 source: "renderOnSilk: aSilk\x0a\x09^ nil",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: []
 }),
 $globals.Object);
@@ -329,6 +339,7 @@ args: [],
 source: "asSilk\x0a\x09^ Silk at: self asString",
 referencedClasses: ["Silk"],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["at:", "asString"]
 }),
 $globals.String);
@@ -353,6 +364,7 @@ args: ["anObject", "aSilk"],
 source: "attrPut: anObject on: aSilk\x0a\x09aSilk attrAt: self put: anObject",
 referencedClasses: [],
 //>>excludeEnd("ide");
+pragmas: [],
 messageSends: ["attrAt:put:"]
 }),
 $globals.String);