This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /** | |
| * Remove whitespace at the start of each line. | |
| * | |
| * Based on Twig's Twig_TokenParser_Spaceless class | |
| */ | |
| class TwigIndentlessTokenParser extends Twig_TokenParser | |
| { | |
| /** | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <LocalizationProvider messages={myLocalizationMessages}> | |
| <Foo> | |
| <h1><LocalizationText key="welcomeMessage" /></h1> | |
| </Foo> | |
| </LocalizationProvider> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | module.controller('MyCtrl', function($scope, $q) { | |
| const promise1 = somethingThatReturnsAPromise(); | |
| const promise2 = somethingElseThatReturnsAPromise(); | |
| const promise3 = yetAnotherCallThatReturnsAPromise(); | |
| // We create a wrapper promise for all the them using $q.all which follows Promise.all of taking an array of promises | |
| const consolidatedPromise = $q.all([promise1, promise2, promise3]); | |
| consolidatedPromise.then(function (promiseValues) { | |
| console.log('Promise 1:', promiseValues[0]); // The value from `promise1.then(function(value){})` | |
| console.log('Promise 2:', promiseValues[1]); // The value from `promise2.then(function(value){})` | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // 3. Use the response | |
| // ================================ | |
| responsePromise | |
| // 3.1 Convert the response into JSON-JS object. | |
| .then(function(response) { | |
| return response.json(); | |
| }) | |
| // 3.2 Do something with the JSON data | |
| .then(function(jsonData) { | |
| console.log(jsonData); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { mount, ReactWrapper } from 'enzyme'; | |
| import { Modal } from 'react-bootstrap'; | |
| // The Enzyme selector query will not work because the actual inside HTML of the modal lives else where in the DOM | |
| // via portals. See: https://react-bootstrap.github.io/react-overlays/#portals | |
| function getWrapperForModalPortal(parentWrapper) { | |
| // The Modal instance provides a reference to HTML content: | |
| // [1] https://github.com/react-bootstrap/react-bootstrap/blob/dddb9b966c7f3e79495be5c5730f7cce04813aaf/src/Modal.js#L228 | |
| // [2] https://github.com/react-bootstrap/react-bootstrap/blob/419051127d913bbb149e81ed221500108ba0d7f3/test/ModalSpec.js#L32 | |
| const modalInstance = parentWrapper.find(Modal).getNode()._modal.getDialogElement(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $ npm test | |
| > [email protected] test /home/user/project | |
| > jest | |
| PASS src/__tests__/WithErrorExample.test.jsx | |
| Example | |
| ✓ Test (108ms) | |
| Test Suites: 1 passed, 1 total | 
OlderNewer