8 – WebDriverTestBase Can not Place / View Block Configuration in AJAX Text

I write a functional test that verifies the output of a page when a user has a specific cookie. Based on this cookie, I have a block powered by Ajax Block that injects custom block content for that user.

I've tried writing the test before doing the implementation. From what I've read, since I test the AJAX behavior, I have to use WebDriverTestBase. Here is the beginning of the test:

class UserGreetingTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ('node', 'block', 'block_ajax', 'user', 'mymodule', 'twig_tweak', 'system');

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->container->get('module_installer')->uninstall(('page_cache'));
    $this->container->get('theme_installer')->install(('mytheme'));
    $this->container->get('config.factory')->getEditable('system.theme')->set('default', 'mytheme')->save();

    $this->drupalPlaceBlock('user_greeting', ('region' => 'user_section', 'theme' => 'mytheme'));

    $this->createContentType(('type' => 'page'));
    $this->drupalCreateNode(('type' => 'page'));
  }

  /**
   * Test the output of the block.
   */
  public function testUserGreeting() {
    $this->drupalGet('/node/1');

At the moment drupalGet is called, the test fails and ends with:

There was 1 error:

1) Drupal Tests mymodule Functional DetectCookieTest :: undefined testUserGreeting Index: ajaxId

I could not really say what was wrong, so I still managed to implement my block. The block works.

My block:

/**
 * Provides a 'Greeting' block.
 *
 * @Block(
 *  id = "user_greeting",
 *  admin_label = @Translation("User Greeting"),
 * )
 */
class HelloUser extends AjaxBlockBase {

  /**
   * The cookie we are looking for in a client session.
   */
  const COOKIE_NAME = 'CUSTOM_COOKIE';

  /**
   * {@inheritdoc}
   */
  public function build() : array {
    $build = parent::build();
    $request = Drupal::request();
    $cookie = $request->cookies->get(self::COOKIE_NAME);
    $has_session = FALSE;

    $username = NULL;
    $greeting = NULL;
    $login_url = 'https://site/login';

    if (isset($cookie)) {
      $url = Url::fromUri($login_url);
      $greeting = Link::fromTextAndUrl('Welcome, ' . $cookie, $url)->toRenderable();
      $has_session = TRUE;
    }

    $build += (
      '#theme' => 'user_greeting',
      '#greeting' => $greeting,
      '#login_url' => $login_url,
      '#has_session' => $has_session,
      '#username' => $username,
      '#cache' => (
        'max-age' => 0,
      )
    );

    return $build;

It seems pretty standard to me.

I can not really say why the test fails because the implementation works. I can visit the site manually in different browsers, and those with the cookie show what I want to see, and the content is retrieved via Ajax Block.

It seems that Ajax Block functionally why does my test fail indicating that the block is missing a configuration value that it should automatically have when it is placed? How do you start debugging, why does a test fail?

The BlockCreationTrait has this task:

Added support for creating custom block instances.

Would it be the culprit?

forms – Use of a fixed decimal place when filling in a currency amount entry field

When entering currency amounts in an input field, I discovered two methods:

Decimal entry: The keyboard includes the decimal character and the user enters the decimal place and the numbers. The Chase mobile app uses this approach.

Key  Display
 5       $5
 4      $54
 .     $54.
 6    $54.6
 3   $54.63

Fixed decimal: The keyboard excludes the decimal and the numbers fill around a fixed decimal place. Both PayPal and Square mobile apps use this approach.

Key  Display
 5    $0.05
 4    $0.54
 6    $5.46
 3   $54.63

The entered decimal approach seems simpler to me. It also requires 2 fewer keystrokes when entering non-decimal amounts (for example, $ 10 only requires 1-0 entry, instead of 1-0-0-0). However, users of our payment processing application have accidentally billed amounts such as $ 123,456.00 instead of $ 1,234.56 because they were expecting a fixed decimal interaction instead of $ 1,000,000. a decimal interaction key.

Is it just a question of preference, or are there any other advantages to a fixed decimal approach that I might overlook?

google – Can you write an evaluation schema for a place that charges a fee?

D & # 39; agreement. This is what I see.

I do not see any reference to abandoning SERP rankings for the imposition of a right of entry.

The article and the announcement of Google do not seem to talk about it.

The article and the announcement mention that the name of the property is mandatory. Where the two are confusing, is that there are more markup schemes that include the name property such as place. Place allows events, reviews and opening hours. The tourist appeal also allows to organize events, reviews and opening hours.

Events allow offers that may include prizes.

Subsequently, it appears that places and tourist attractions would be allowed based on the announcement where a charge might exist (with a caveat to follow), however, what is confusing is that these patterns do are not included in the list.

I have only to conclude that these schemes are allowed to be examined and to charge fees, which seems to me perfectly logical. A warning exists. In the article and the announcement, reviews can not be managed by the site itself or by a widget on the site. Personally, I do not agree with that, reviews from another site without using any widget can be used. Unfortunately, I am not familiar enough to know how it would work. For example, can you have Yelp reviews without a widget? There may be a WordPress plug-in that can help WP users. What other options exist? Who knows.

It is unclear exactly where the line is drawn, even with what seems to be simple rules. You are right to be confused. Personally, thinking of local attractions, I do not see why an attraction should not be commented. I am as confused as you.

The only thing I can see is to try without soliciting comments on the site or through a widget on the site and see what happens.

java – How can I place top and bottom objects on Android?

Hello, I want to put a fragment under an object and the margiBottom do it up to another button but if I put the code of the layout_marginBottom, the application will close

………………………………………….. ………………………………………….. ………………………………………….. ………………………………………….. ………………………………………….. ………………………………………….. ……………….

the frameLayout is inside a parent

  


    

    

    

    

    

    

    

    

    


and the error that arises is this

2019-09-16 13:42:25.358 12603-12603/com.radio.shalommadrid E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.radio.shalommadrid, PID: 12603
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.radio.shalommadrid/com.radio.shalommadrid.MainActivity}: android.view.InflateException: Binary XML file line #101: Can't convert value at index 6 to dimension: type=0x12

javascript – How to place 4 decimals even if the number is integer?

I have to enter 4 decimals even if the number is integer and if any number is entered after the point automatically filled with zero, for example if I enter a 13 which seems to me 13,0000 and if I enter a 23.1 filled by 23,1000. I tested with tofixed and when saving in the database, it does not work. How can I solve it?

[ Politics ] Open question: Have you read Michelle Malkin's new book (open boarders inc)? He sketches All criminal cases that the DNC has put in place to support it.

(Politics) Open question: Have you read Michelle Malkin's new book (open boarders inc)? He sketches
All criminal cases that the DNC has put in place to support it. (tagsToTranslate) yahoo (t) answers (t) questions (t) Politics & Government (t) Politics

numerical methods – Determination of the place of piecewise quadratic interpolation

Suppose we want to interpolate n + 1 data points (n> 2) with a piecewise quadratic polynomial.
How many continuous derivatives at most this interpolant can be guaranteed to have
without becoming a global polynomial? Explain.

Therefore, our polynomial of interpolation is as follows:
$$ v (x_i) = s_i (x_i) = a_i + b_i (x-x_i) + c_i (x-x_i) ^ 2 $$ with $ i = 3, …., n + 3 $ and $ x in (x_i, x_ {i + 1}) $. Therefore, should not we lose our locality when $ s_i (x_i) $ no longer depends on $ x $, that is, after differentiating a second time? This seems not to be correct and depends instead on the constraints that must be imposed on $ s_i (x_i) $ manage $ a_i, b_i, c_i $. So with that we would have $ 3n $ constraints, so we could have
$$ s_i (x_i) = f (x_i) $$
$$ s_ {i + 1} (x_ {i + 1}) = f (x_ {i + 1}) $$
$$ s_i (x_i) = f & # 39; (x_i) $$
So, looking at this, maybe we can guarantee our interpolating to be $ C ^ 1 $ without becoming a global polynomial, but I'm still not sure.

Any advice is appreciated, thank you!

e commerce – Best place to display a confirmation modal in a shopping stream

So I'm working on an insurance ecommerce and would like to know where to show a confirmation modal. Let's say I'm in the summary page and there is a "Change Plan" button to choose another plan. I have to choose where to display the confirmation modal

Option 1. Once the user has clicked on the "Edit" button, he is redirected to the Plans page. And just after the user clicks the "I want this plan" button to validate the change, display the modal.

Option 2. Display the modal in the summary page just after the user has clicked the "Edit Plan" button. And then redirect the user to the plan page.

I think that option 1 works best because the modal is displayed just before validating the change, but option 2 can also work. Any comment is appreciated.

Prototype showing both options
https://www.figma.com/proto/nuRTOn8ZdMjGLkHrQXOZge/Untitled?node-id=6%3A38&viewport=-570%2C195%2C0.6362286806106567&scaling=min-zoom

Correct position to place the search bar in the article catalog

I am building an ecommerce platform that asks a user to search for the desired features. I realize that a search bar is an important feature, but at the moment I do not know where to put it. I would appreciate any advice:

Main view:

enter the description of the image here

Drop down menu:

enter the description of the image here

Filtered:

enter the description of the image here

woocommerce – add a product to the cart with a personalized price and display the customized price of the product to cart and place the order

I want to update the price of the product before adding to the cart and also display the product price of the update to the cart page, how to do the same?

I am tired but this one does not show the price of the update on the page of the basket … it shows only the total of the page of payment

Is there a way to do the same? please guide