update hello world (#1392)

* update hello world

* Update README.md
This commit is contained in:
oblomov-dev 2024-09-08 19:18:19 +02:00 committed by GitHub
parent 71ea2631b6
commit f01f1ef57e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 19 deletions

View File

@ -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( ) ).

View File

@ -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.

View File

@ -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.

View File

@ -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.