mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 22:09:24 +08:00
parent
71ea2631b6
commit
f01f1ef57e
|
@ -146,14 +146,14 @@ CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
|
|||
|
||||
CASE client->get( )-event.
|
||||
WHEN 'POST'.
|
||||
client->message_toast_display( |Your name is { name }.| ).
|
||||
client->message_box_display( |Your name is { name }.| ).
|
||||
ENDCASE.
|
||||
|
||||
client->view_display( z2ui5_cl_xml_view=>factory(
|
||||
)->page( 'abap2UI5 - Hello World App'
|
||||
)->page( 'abap2UI5 - Hello World'
|
||||
)->simple_form( )->content( ns = `form`
|
||||
)->title( 'Input here and send it to the server...'
|
||||
)->label( 'What is your name?'
|
||||
)->label( 'Name'
|
||||
)->input( client->_bind_edit( name )
|
||||
)->button( text = 'post' press = client->_event( 'POST' )
|
||||
)->stringify( ) ).
|
||||
|
|
|
@ -24,11 +24,11 @@ CLASS z2ui5_cl_core_app_hello_w IMPLEMENTATION.
|
|||
|
||||
client->view_display( z2ui5_cl_xml_view=>factory(
|
||||
)->shell(
|
||||
)->page( title = 'abap2UI5 - Hello World App'
|
||||
)->page( title = 'abap2UI5 - Hello World'
|
||||
)->simple_form( editable = abap_true
|
||||
)->content( ns = `form`
|
||||
)->title( 'Make an input here and send it to the server...'
|
||||
)->label( 'Enter your name'
|
||||
)->label( 'Name'
|
||||
)->input( client->_bind_edit( name )
|
||||
)->button( text = 'post' press = client->_event( 'BUTTON_POST' )
|
||||
)->stringify( ) ).
|
||||
|
@ -37,7 +37,7 @@ CLASS z2ui5_cl_core_app_hello_w IMPLEMENTATION.
|
|||
|
||||
CASE client->get( )-event.
|
||||
WHEN 'BUTTON_POST'.
|
||||
client->message_toast_display( |Your name is { name }| ).
|
||||
client->message_box_display( |Your name is { name }| ).
|
||||
WHEN OTHERS.
|
||||
ENDCASE.
|
||||
|
||||
|
|
|
@ -49,9 +49,13 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
|
|||
|
||||
METHOD main.
|
||||
|
||||
result = SWITCH #( body
|
||||
WHEN `` THEN http_get( config )
|
||||
ELSE http_post( body ) ).
|
||||
IF body IS INITIAL.
|
||||
DATA(lo_get) = NEW z2ui5_cl_core_http_get( config ).
|
||||
result = lo_get->main( ).
|
||||
ELSE.
|
||||
DATA(lo_post) = NEW z2ui5_cl_core_http_post( body ).
|
||||
result = lo_post->main( ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING
|
|||
|
||||
PRIVATE SECTION.
|
||||
METHODS test_get FOR TESTING RAISING cx_static_check.
|
||||
METHODS test_post FOR TESTING RAISING cx_static_check.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
@ -15,19 +15,11 @@ CLASS ltcl_unit_test IMPLEMENTATION.
|
|||
|
||||
METHOD test_get.
|
||||
|
||||
DATA(lv_resp) = z2ui5_cl_http_handler=>http_get( ).
|
||||
DATA(lv_resp) = z2ui5_cl_http_handler=>main( `` ).
|
||||
IF lv_resp IS INITIAL.
|
||||
cl_abap_unit_assert=>fail( 'HTTP GET' ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_post.
|
||||
|
||||
* DATA(lv_resp) = z2ui5_cl_http_handler=>http_post( value #( ) ).
|
||||
* IF lv_resp IS INITIAL.
|
||||
* cl_abap_unit_assert=>fail( 'HTTP POST' ).
|
||||
* ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
Loading…
Reference in New Issue
Block a user