-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
e4df642
commit ecf4fa9
Showing
3 changed files
with
36 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,7 +291,6 @@ component extends="coldbox.system.testing.BaseTestCase" { | |
var result = CBWIREController.wire( "test.should_not_render_cbwire_script_tags" ); | ||
expect( result ).notToInclude( "<cbwire:script>" ); | ||
expect( result ).notToInclude( "</cbwire:script>" ); | ||
expect( result ).notToInclude( "This should not be rendered" ); | ||
} ); | ||
|
||
it( "should not render cbwire:assets tags", function() { | ||
|
@@ -301,17 +300,11 @@ component extends="coldbox.system.testing.BaseTestCase" { | |
expect( result ).notToInclude( "tailwind.min.css" ); | ||
} ); | ||
|
||
fit( "should track scripts and assets in snapshot memo", function() { | ||
var result = CBWIREController.wire( "test.should_track_scripts_and_assets_in_snapshot_memo" ); | ||
it( "should track scripts in snapshot memo", function() { | ||
var result = CBWIREController.wire( "test.should_track_scripts_in_snapshot_memo" ); | ||
var parsing = parseRendering( result ); | ||
writeDump( parsing.snapshot.memo ); | ||
abort; | ||
expect( parsing.snapshot.memo.scripts ).toBeArray(); | ||
expect( parsing.snapshot.memo.scripts.len() ).toBe( 1 ); | ||
expect( parsing.snapshot.memo.scripts[ 1 ] ).toBe( "https://cdn.jsdelivr.net/npm/[email protected]/dist/alpine.min.js" ); | ||
expect( parsing.snapshot.memo.assets ).toBeArray(); | ||
expect( parsing.snapshot.memo.assets.len() ).toBe( 1 ); | ||
expect( parsing.snapshot.memo.assets[ 1 ] ).toBe( "tailwind.min.css" ); | ||
expect( parsing.snapshot.memo.scripts.len() ).toBe( 2 ); | ||
} ); | ||
|
||
xit( "should provide original path to component when there is a template rendering error", function() { | ||
|
@@ -463,6 +456,23 @@ component extends="coldbox.system.testing.BaseTestCase" { | |
settings.trimStringValues = false; | ||
} ); | ||
|
||
it( "should track cbwire:assets in http response", function() { | ||
var payload = incomingRequest( | ||
memo = { | ||
"name": "test.should_track_cbwire_assets_in_http_response", | ||
"id": "Z1Ruz1tGMPXSfw7osBW2", | ||
"children": [] | ||
}, | ||
data = {}, | ||
calls = [], | ||
updates = {} | ||
); | ||
var result = cbwireController.handleRequest( payload, event ); | ||
expect( result.assets.count() ).toBe( 1 ); | ||
var keys = result.assets.keyArray(); | ||
expect( result.assets[ keys.first() ] ).toInclude( "tailwind.min.css" ); | ||
} ); | ||
|
||
it( "should support $refresh action", function() { | ||
var payload = incomingRequest( | ||
memo = { | ||
|
15 changes: 15 additions & 0 deletions
15
test-harness/wires/test/should_track_cbwire_assets_in_http_response.cfm
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,15 @@ | ||
<cfoutput> | ||
<div> | ||
<h1>Should track assets in http response</h1> | ||
</div> | ||
</cfoutput> | ||
|
||
<cfscript> | ||
// @startWire | ||
// @endWire | ||
</cfscript> | ||
|
||
<cbwire:assets> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css"> | ||
</cbwire:script> |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<cfoutput> | ||
<div> | ||
<h1>Should track scripts and assets</h1> | ||
<h1>Should track scripts</h1> | ||
</div> | ||
</cfoutput> | ||
|
||
|
@@ -20,8 +20,4 @@ | |
<script> | ||
console.log('This should be tracked also'); | ||
</script> | ||
</cbwire:script> | ||
|
||
<cbwire:assets> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css"> | ||
</cbwire:script> |