Skip to content

Commit 0a018fb

Browse files
committed
Updates copilot apparently wouldn't make
1 parent 4597238 commit 0a018fb

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

models/Component.cfc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ component output="true" accessors="true" {
8181
variables._redirect = "";
8282
variables._redirectUsingNavigate = false;
8383
variables._isolate = false;
84+
variables._path = "";
8485
variables._renderedContent = "";
8586
variables._scripts = [:];
8687
variables._assets = [:];

models/services/RenderService.cfc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ component accessors="true" singleton {
168168
* to a slash notation path, check for the existence of .bxm or .cfm files, and ensure the path is correctly formatted.
169169
*
170170
* @viewPath string | The dot notation path to the view template to be rendered, without the .cfm extension.
171+
* @componentPath string | The component path, used to determine if the normalized path should be prefixed with "wires/".
171172
*
172173
* @return string
173174
*/
@@ -190,7 +191,7 @@ component accessors="true" singleton {
190191
throw( type="CBWIREException", message="A .bxm or .cfm template could not be found for '#arguments.viewPath#'." );
191192
}
192193

193-
if ( !find( "@", arguments.componentPath ) && left( paths.normalizedPath, 6 ) != "wires/" ) {
194+
if ( !isNull( arguments.componentPath ) && !find( "@", arguments.componentPath ) && left( paths.normalizedPath, 6 ) != "wires/" ) {
194195
paths.normalizedPath = "wires/" & paths.normalizedPath;
195196
}
196197
if ( left( paths.normalizedPath, 1 ) != "/" ) {

test-harness/tests/specs/unit/services/RenderServiceSpec.cfc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,15 @@ component extends="coldbox.system.testing.BaseTestCase" {
264264
it( "should return .bxm path when .bxm file exists", function() {
265265
var input = "my.view.template";
266266
// simulate the components variables._path which is what is passed to the wire() method
267-
var component_path = "my.view.template";
267+
var componentPath = "my.view.template";
268268
var bxmAbsolutePath = expandPath( "/my/view/template.bxm" );
269269
var cfmAbsolutePath = expandPath( "/my/view/template.cfm" );
270270
var expectedPath = "/wires/my/view/template.bxm";
271271

272272
mockUtility.$( "fileExists" ).$args( bxmAbsolutePath ).$results( true );
273273
mockUtility.$( "fileExists" ).$args( cfmAbsolutePath ).$results( false );
274274

275-
var result = renderService.normalizeViewPath( input, component_path );
275+
var result = renderService.normalizeViewPath( input, componentPath );
276276
expect( result ).toBe( expectedPath );
277277
});
278278

@@ -292,14 +292,14 @@ component extends="coldbox.system.testing.BaseTestCase" {
292292
});
293293

294294
it( "should return .cfm module path when wire is located in module wires directory", function() {
295-
var input = "modules_app.testingModule.wires.twoFileModuleComponent";
295+
var input = "modules_app.testingmodule.wires.twoFileModuleComponent";
296296
// simulate the components variables._path which is what is passed to the wire() method
297-
var component_path = "twoFileModuleComponent@testingModule";
297+
var component_path = "twoFileModuleComponent@testingmodule";
298298
// use full path to module wire
299-
var bxmAbsolutePath = expandPath( "../modules_app/testingModule/wires/twoFileModuleComponent.bxm" );
300-
var cfmAbsolutePath = expandPath( "../modules_app/testingModule/wires/twoFileModuleComponent.cfm" );
299+
var bxmAbsolutePath = expandPath( "../modules_app/testingmodule/wires/twoFileModuleComponent.bxm" );
300+
var cfmAbsolutePath = expandPath( "../modules_app/testingmodule/wires/twoFileModuleComponent.cfm" );
301301

302-
var expectedPath = "/modules_app/testingModule/wires/twoFileModuleComponent.cfm";
302+
var expectedPath = "/modules_app/testingmodule/wires/twoFileModuleComponent.cfm";
303303
// mock the file exists calls for both .bxm and .cfm paths
304304
mockUtility.$( "fileExists" ).$args( bxmAbsolutePath ).$results( false );
305305
mockUtility.$( "fileExists" ).$args( cfmAbsolutePath ).$results( true );

0 commit comments

Comments
 (0)