Skip to content

Commit

Permalink
#3 Feature: Add a button in the web view to open the test method
Browse files Browse the repository at this point in the history
Also change the way we display, we now store on the disk the result.html, this solve a lot of platform issue and make the web area embedded engine to work which was necessary to launch a 4D method from the webarea.
  • Loading branch information
Gabriel Inzirillo committed Jan 29, 2021
1 parent 71cf281 commit 6311c39
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 52 deletions.
90 changes: 45 additions & 45 deletions AJ_Tools_UnitTest/Project/Sources/Methods/AJ_Tools_runAll_cb.4dm
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
//%attributes = {"invisible":true}
// AJ_Tools_runAll_cb ( $parsedResult )
//
// $parsedResult : (object) parsed result returned by AJ_Tools_UT_runAll
//
// Callback for the run all when used in a main form window
If (False:C215)
// ----------------------------------------------------
// User name (OS): gabriel inzirillo
// Date and time: 17.07.19, 16:47:33
// ----------------------------------------------------
// Method: AJ_Tools_runAll_cb
//
// ----------------------------------------------------
// Copyrights (C) AJAR SA - 2019
End if
C_OBJECT:C1216($1;$result)
$result:=$1
If ($result.lastCall=Null:C1517)
// Results
AJ_Tools_UT_results.tests.unshift($result)
Else
// Last step
Case of
: (Form:C1466.timerCase="all")
Form:C1466.parsedResult:=$result
AJ_Tools_UT_buildList_UI
: (Form:C1466.timerCase="selected")
End case
$template:=Document to text:C1236(Get 4D folder:C485(Current resources folder:K5:16)+"results_template.shtml";"UTF-8")
$baseURL:="File:///"+Replace string:C233(Convert path system to POSIX:C1106(Get 4D folder:C485(Current resources folder:K5:16));"Macintosh HD/";"")
PROCESS 4D TAGS:C816($template;$result_html;$result;$baseURL)
WA SET PAGE CONTENT:C1037(*;"results_wa";$result_html;"")
OBJECT SET VISIBLE:C603(*;"results_wa";True:C214)
OBJECT SET VISIBLE:C603(*;"results_lb";False:C215)
Form:C1466.view:="wa"
Form:C1466.timerCase:=""
//%attributes = {"invisible":true}
// AJ_Tools_runAll_cb ( $parsedResult )
//
// $parsedResult : (object) parsed result returned by AJ_Tools_UT_runAll
//
// Callback for the run all when used in a main form window

If (False:C215)
// ----------------------------------------------------
// User name (OS): gabriel inzirillo
// Date and time: 17.07.19, 16:47:33
// ----------------------------------------------------
// Method: AJ_Tools_runAll_cb
//
// ----------------------------------------------------
// Copyrights (C) AJAR SA - 2019
End if

C_OBJECT:C1216($1; $result)
$result:=$1

If ($result.lastCall=Null:C1517)
// Results
AJ_Tools_UT_results.tests.unshift($result)

Else
// Last step
Case of
: (Form:C1466.timerCase="all")
Form:C1466.parsedResult:=$result
AJ_Tools_UT_buildList_UI
: (Form:C1466.timerCase="selected")
End case

$template:=Document to text:C1236(Get 4D folder:C485(Current resources folder:K5:16)+"results_template.shtml"; "UTF-8")

PROCESS 4D TAGS:C816($template; $result_html; $result)
TEXT TO DOCUMENT:C1237(Get 4D folder:C485(Current resources folder:K5:16)+"results.html"; $result_html; "UTF-8")

WA OPEN URL:C1020(*; "results_wa"; Get 4D folder:C485(Current resources folder:K5:16)+"results.html")
OBJECT SET VISIBLE:C603(*; "results_wa"; True:C214)
OBJECT SET VISIBLE:C603(*; "results_lb"; False:C215)

Form:C1466.view:="wa"
Form:C1466.timerCase:=""
End if
2 changes: 2 additions & 0 deletions AJ_Tools_UnitTest/Project/Sources/Methods/openMethod.4dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//%attributes = {"invisible":true}
METHOD OPEN PATH:C1213($1)
1 change: 1 addition & 0 deletions AJ_Tools_UnitTest/Resources/results.html

Large diffs are not rendered by default.

30 changes: 23 additions & 7 deletions AJ_Tools_UnitTest/Resources/results_template.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@

<head>
<title>Unit Tests Results</title>
<link rel="stylesheet" href="$4DEVAL($2)/bootstrap.min.css">
<script src="$4DEVAL($2)/jquery-3.3.1.slim.min.js"></script>
<script src="$4DEVAL($2)/popper.min.js"></script>
<script src="$4DEVAL($2)/bootstrap.min.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="$4DEVAL($2)/bootstrap.min.css">
<script type="text/javascript" src="$4DEVAL($2)/jquery-3.3.1.slim.min.js"></script>
<script type="text/javascript" src="$4DEVAL($2)/popper.min.js"></script>
<script type="text/javascript" src="$4DEVAL($2)/bootstrap.min.js"></script> -->
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<script type="text/javascript" src="jquery-3.3.1.slim.min.js"></script>
<script type="text/javascript" src="popper.min.js"></script>
<script type="text/javascript" src="bootstrap.min.js"></script>



<script type="text/javascript">
/* See LICENSE file for terms of use */
Expand Down Expand Up @@ -408,9 +414,11 @@
})();





function methodButton_cb(event) {
event.stopPropagation();
let methodName = event.target.getAttribute('data-methodname');
$4d.openMethod(methodName);
}

$(document).ready(function () {

Expand Down Expand Up @@ -460,7 +468,12 @@
.actual del {
display: none;
}

.methodButton {
float: right;
}
</style>

</head>

<body>
Expand Down Expand Up @@ -534,6 +547,9 @@
data-toggle="collapse" data-target="#description$4DEVAL($id)_body" aria-expanded="true"
aria-controls="description$4DEVAL($id)_body">
<span style="font-size:17pt">$4DEVAL($results.categories[$i].descriptions[$j].description)</span>
<button onClick="methodButton_cb(event)"
data-methodname="$4DEVAL($results.categories[$i].descriptions[$j].method)"
class="methodButton btn btn-primary">Open Method</button>
</div>
<div id="description$4DEVAL($id)_body" class="collapse show"
aria-labelledby="description$4DEVAL($id)_header">
Expand Down

0 comments on commit 6311c39

Please sign in to comment.