JAVASCRIPT DEVELOPER PRACTICE TEST P1(MAGENTO 2 CERTIFIED )

Descripción

Pool one: about 30 , This is my study Notes, MAGENTO 2 CERTIFIED JAVASCRIPT DEVELOPER PRACTICE TEST, Final Exam:60 Multiple Choice items 90 minutes to complete the exam Score of 63% or higher needed to pass Based on Magento Open Source (2.x) & Commerce (2.x), but applicable to those using any version of Magento 2.x
Miska Red
Test por Miska Red, actualizado hace más de 1 año
Miska Red
Creado por Miska Red hace alrededor de 5 años
1961
4

Resumen del Recurso

Pregunta 1

Pregunta
You are debugging a problem with a UI Component form and notice that Magento_Ui/js/dynamic-rows/action-delete.js does not specify a template, but is loading the templates/dynamic-rows/cells/action-delete.html. You have already looked in the UI Component XML file and it is not there. Where would the template path be specified?
Respuesta
  • definition.xml under the <actionDelete/> node.
  • The dynamic-rows parent component’s defaults object.
  • requirejs-config.js in Magento_Ui under the template key.
  • Nowhere specifically. Magento automatically looks up the template by default based on the component name.

Pregunta 2

Pregunta
A 3rd-party module installed on the site you are working on adds several pie-chart reports in the admin panel. It uses a 1000-line jQuery widget to render the pie chart. You have been asked to fix a bug and after some work discover the problem within the jQuery widget. Keeping maintainability in mind, how should you fix the problem?
Respuesta
  • Create a mixin and return a jQuery widget with the same name as the original. Use the second parameter in the widget constructor for the original widget object and override only the necessary methods.
  • Copy the entire 3rd party extension directory from vendor/ into the site’s app/code folder and edit the Javascript file directly since it is a bug.
  • Create a mixin for the module and copy the entire original widget into it, updating the problematic method as needed.
  • Copy the Javascript module into your own module and use RequireJs config with the “map” key to update the path so the custom version you have created is used instead.

Pregunta 3

Pregunta
You are working on a site that extends a 3rd-party theme. You need to completely change how the breadcrumb component renders (originally in Magento_Catalog/js/product/breadcrumbs.js). However, the 3rd-party theme already modifies this. You are building a module, SwiftOtter_Catalog, that contains similar updates. Keeping upgradeability and maintainability in mind, what two ways that you can make these updates?
Respuesta
  • Create a mixin in SwiftOtter_Catalog’s requirejs-config.js and override all applicable methods.
  • Copy app/design/frontend/3rd-party/Theme/Magento_Catalog/web/js/product/breadcrumbs.js to app/design/frontend/merchant/Theme/Magento_Catalog/web/js/product/breadcrumbs.js.
  • Edit app/design/frontend/3rd-party/Theme/Magento_Catalog/web/js/product/breadcrumbs.js to include the necessary changes.
  • Delete app/design/frontend/3rd-party/Theme/Magento_Catalog/web/js/product/breadcrumbs.js and create a new file in app/code/SwiftOtter/Catalog/view/frontend/web/web/js/product/breadcrumbs.js

Pregunta 4

Pregunta
You have built a Javascript module that relies on the following .phtml code:<?php // app/code/MyCompany/MyModule/view/frontend/templates/render.phtml ?> <div data-mage-init=’{“MyCompany_MyModule/js/welcome”: {}}’> <?php if ($viewModel->canRenderWelcome()):?> <span data-bind=”text: welcomeText()”></span> <?php endif;?> </div> Unfortunately, the span is always empty. What is the solution?
Respuesta
  • Add the attribute data-bind=”scope: ‘[component in uiRegistry]’” to the <div/> tag.
  • Add a bind-directives: true into the properties passed into MyCompany_MyModule/js/welcome.
  • Convert the data-mage-init statement into initializing a uiComponent so that the content is properly rendered.
  • Refactor into using an external template. Then, use Knockout getTemplate in the constructor of MyCompany_MyModule/js/welcome.

Pregunta 5

Pregunta
A merchant wants you to add a close button to collapse an opened tab on a product page. The Magento Tabs widget is used for the tabs. You add this code to your template: <button data-action="close" translate="'Close'"/> Keeping upgradability in mind, how do you implement this functionality?
Respuesta
  • Extend the Magento Tabs widget and add a callback for the button there
  • Add an attribute onclick="$.mage.tabs.close()" to the button
  • Add a callback for the button in the Magento Tabs widget in lib/web/mage/tabs.js
  • Add a data-bind="click: close" attribute to the button

Pregunta 6

Pregunta
A merchant has asked that the price of their free shipping method, which natively is displayed as $0.00, instead is displayed as FREE in the checkout in their store's theme. How do you make the change?
Respuesta
  • Copy the shipping-method-item Knockout HTML template from Magento_Checkout to your theme and add the following to the template: <!-- ko if: (element.getRegion('price') === '$0.00') -->FREE<!-- /ko --> <!-- ko if: (element.getRegion('price') !== '$0.00') -->element.getRegion('price')<!-- /ko-->
  • Add the translation '$0.00','FREE' to your theme's translation CSV file.
  • Copy the appropriate view/shipping.js file from Magento_Checkout to your theme and change the form uiComponent's rate property to: rates:shippingService.getShippingRates().replace('$0.00', 'FREE');
  • Create a requirejs-config.js file and create a Magento mixin to replace the native shipping-method-item Knockout HTML template.

Pregunta 7

Pregunta
During a code review you notice the following code: $('#element').collapsible({ ajaxContent: 'true', ajaxUrlElement: '.my-ajax-url', content: '.my-content' }); What is your peer's desired result in using ajaxUrlElement?
Respuesta
  • Magento will replace the element .my-ajax-url with content loaded via AJAX from the data-url attribute set in the element .my-ajax-url.
  • Magento will find the element .my-ajax-url and load the content from that element's href attribute into .mycontent.
  • Magento will do a POST AJAX request on the href in .my-content and load the content in the .my-ajax-url element.
  • .my-ajax-url element.
  • Magento will do a GET AJAX request on the data-url attribute in my-ajax-url and load the content in the

Pregunta 8

Pregunta
You Create a RequireJS configuration file requirejs-config.js, having specified the following: var config = { "map": { "*": { "<default_component><custom_component>" } } }; What do you meaning <default_component> & <custom_component> ? (select 2)
Respuesta
  • <default_component>: the name of the default component you replace
  • <custom_component>: the name of the custom component
  • <default_component>: the name of the custom component
  • <custom_component>: the name of the default component you replace

Pregunta 9

Pregunta
You need to Replace a default JS component, To use a custom implementation of an existing Magento JS component: Place the custom component source file in one of the --------- locations: (Select 2)
Respuesta
  • Theme JS files: /web/js or /_/web/js
  • Module view JS files:<module_dir>/view/frontend/web/js
  • Module view JS files: <module_dir>/web/js
  • Theme JS files: /view/frontend/web/js or /_/view/frontend/web/js

Pregunta 10

Pregunta
By default, the Magento application uses the --- and ---to optimize the time of loading pages with included JavaScript files, and to manage dependencies of JavaScript resources.
Respuesta
  • RequireJS
  • module loader
  • VueJs
  • AngualJS

Pregunta 11

Pregunta
You are Explore JavaScript resources JS resources location Where you can find the JS components of Library level?
Respuesta
  • (lib/web). Resources located here are available in any place in Magento.
  • <module_dir>/view/<areaname>/web. If the module is enabled, resources added here are available in other modules and themes.
  • <theme_dir>/<VendorName>_<ModuleName>/web. Resources added here are available for [inheriting] themes.
  • <theme_dir>/web. Resources added here are available for [inheriting] themes.

Pregunta 12

Pregunta
You are Explore JavaScript resources JS resources location Where you can find the JS components of "Module level" ?
Respuesta
  • (<module_dir>/view/<areaname>/web). If the module is enabled, resources added here are available in other modules and themes
  • (<theme_dir>/<VendorName>_<ModuleName>/web). Resources added here are available for [inheriting] themes.
  • (<theme_dir>/web). Resources added here are available for [inheriting] themes.
  • (lib/web). Resources located here are available in any place in Magento.

Pregunta 13

Pregunta
You are Explore JavaScript resources JS resources location Where you can find the JS components of "Theme level, for a particular module" ?
Respuesta
  • (<theme_dir>/<VendorName>_<ModuleName>/web). Resources added here are available for [inheriting] themes
  • (<theme_dir>/web). Resources added here are available for [inheriting] themes.
  • (lib/web). Resources located here are available in any place in Magento.
  • (<module_dir>/view/<areaname>/web). If the module is enabled, resources added here are available in other modules and themes.

Pregunta 14

Pregunta
You are Explore JavaScript resources JS resources location Where you can find the JS components of "Theme level " ?
Respuesta
  • (<theme_dir>/web). Resources added here are available for [inheriting] themes.
  • (<theme_dir>/<VendorName>_<ModuleName>/web). Resources added here are available for [inheriting] themes.
  • (<module_dir>/view/<areaname>/web). If the module is enabled, resources added here are available in other modules and themes
  • (lib/web). Resources located here are available in any place in Magento

Pregunta 15

Pregunta
You are Accessing JS resources JS resources are accessed using relative paths. File actual location: app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js File published to pub/static: pub/static/frontend/Magento/<theme>/<locale>/Magento_ConfigurableProduct/js/configurable.js. Here <theme> and <locale> are the currently applied in your instance theme and locale. How to Called in script?
Respuesta
  • require(["Magento_ConfigurableProduct/js/configurable"], function(Configurable){ });
  • require(["js/theme.js"], function(){ });
  • require(["jquery"], function($){ });
  • require(["configurable"], function($){ });

Pregunta 16

Pregunta
You are Accessing JS resources, JS resources are accessed using relative paths.File actual location: app/design/frontend/Magento/blank/Magento_Theme/web/js/theme.js File published to pub/static: pub/static/frontend/Magento/<theme>/<locale>/js/theme.js How to Called in script?
Respuesta
  • require(["js/theme.js"], function(){ });
  • require(["web/js/theme.js"], function(){ });
  • require(["theme"], function($){ });
  • require(["theme.js"], function($){ });

Pregunta 17

Pregunta
You are Accessing JS resources, JS resources are accessed using relative paths actual location: lib/web/jquery.js File published to pub/static: pub/static/<area>/Magento/<theme>/<locale>/jquery.js How to Called this script?
Respuesta
  • require(["jquery"], function($){ });
  • require(["jquery.js"], function($){ });
  • require(["lib/web/jquery.js"], function($){ });
  • require(["web/jquery.js"], function($){ });

Pregunta 18

Pregunta
You are creating Dependencies between JavaScript resources To build a dependency on the third-party plugin, specify a [shim] in the following configuration files: requirejs-config.js var config = { "shim": { "3-rd-party-plugin": ["jquery"] } }; What is content example of <third-party-plugin>.js ?
Respuesta
  • !(function($){ // plugin code // where $ == jQuery })(jQuery);
  • (function($){ // plugin code // where $ == jQuery })(jQuery);
  • (function($shim){ // plugin code // where $ == jQuery })(jQuery);
  • (function(shim){ // plugin code // where $ == jQuery })($);
Mostrar resumen completo Ocultar resumen completo

Similar

PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Miska Red
SOLUTION SPECIALIST TEST-01 (MAGENTO 2 CERTIFIED )
Miska Red
Cloud Developer Exam Test-01(MAGENTO 2 CERTIFIED Professional )
Miska Red
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Станислав Матявин
Magento 2 Cloud
Oleksiy P
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Dario Dorfelli
Bloc testing
Sanny Lin
MAGENTO 2 CERTIFIED SOLUTION SPECIALIST PRACTICE TEST
Pankaj Sharma
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
test test
SOLUTION SPECIALIST TEST-01 (MAGENTO 2 CERTIFIED )
Khrystyna Balog
Magento 2 Certified Professional Front End Developer Exam Questions
Benoit Alix