Is there a way to check layout with selenium RC - layout

I want to check the layout of the page. Something pretty simple - that a certain div is displayed above/below/left/right of another div
Is it possible to do this kind of stuff?

Using the Ruby client (#selenium is my SeleniumDriver object):
To check if a certain element is above another div:
#selenium.get_element_position_top("firstdiv") <
#selenium.get_element_position_top("seconddiv")
To check if a certain element is left to another div:
#selenium.get_element_position_left("firstdiv") <
#selenium.get_element_position_left("seconddiv")
If you also want to check that the elements don't overlap, compare the top of the element to the bottom of the other:
#selenium.get_element_position_top("firstdiv") +
#selenium.get_element_height("firstdiv") <
#selenium.get_element_position_top("seconddiv")

You can do it with Galen Framework. It is a tool based on Selenium but with its own special language.
The idea is that you test locations of page elements relatively to each other. Here is a basic example of how the test code looks like.
# all
------------------------------------
header, menu, footer
width: 100% of screen/width
header
height: 100px
above: menu 0px
menu
height: 50px
above: content 0px
footer
height: > 100px
content
inside: screen 0px left
# desktop, tablet
-----------------------------------
side-panel
width: 300px
below: menu 0px
inside: screen 0px right
near: content 10px right
# mobile
-----------------------------------
side-panel, content
width: 100% of screen/width
side-panel
below: content 5px
For more information you can read this article TDD for Responsive Design

Related

PagerSetting at the bottom of a grid does not display correct

Is there a way to fix the vertical layout of the PagerSettings when displayed at the bottom of a grid?
UPDATE: I am working on build 19.110.0013
I am trying to add numbers to the bottom of a grid using the PagerSettings tag described in the post Add page numbers to the bottom of Process Shipments grid. When I set the PagerVisible to bottom the numbers display vertical, but if I set the PagerVisible to top the numbers are properly displayed as horizontal.
<ActionBar PagerVisible="Bottom" DefaultAction="cmdItemDetails">
<PagerSettings Mode="Numeric" LinksCount="5" />
</ActionBar>
I could not reproduce that behavior in Acumatica version 19.106.0020 so I manually tweaked the CSS in order to reproduce that glitch.
Setting 'display: block' CSS property on GridPagerLink CSS class reproduces the same rendering.
In file '\App_Themes\Default\00_Controls.css' it is set as 'display: inline-block;'.
Inline option will make them stack horizontally so I don't have this glitch on my side.
Which exact Acumatica version are you running?
Use browser HTML inspect element feature to inspect the GridPagerLink.
Does it look like the default style below?
.GridPagerLink {
display: inline-block;
color: RGBA(0, 0, 0, 0.87);
text-decoration: none;
font-size: 15px;
font-weight: bold;
padding: 5px 10px;
height: 18px;
border: solid 1px transparent;
}

Use react-virtualized Window Scroller with frozen header and footer

I am using react-virtualized WindowScroller with CellMeasurer to scroll through a 100 sample records and by itself, it works great.
Now, when I place this component in a content pane with a frozen header and footer (using flex) above and below it, react-virtualized does not bring in additional data beyond the first page.
The structure of my container page is the same as the create-react-app template:
<div className="App">
<div className="App-header" />
<div className="App-intro" />
<div className="App-footer" />
</div>
and here is the CSS I use to freeze the header and footer:
html, body, #root {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
.App {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.App-header, .App-footer {
flex-shrink: 0;
}
.App-intro {
flex-grow: 1;
overflow-y: auto;
}
FWIW, the official WindowScroller example accomplishes a frozen header using flex, but try as I might, I am not able to replicate it on my end.
I am at my wit's end after spending a whole entire day on this. I would really really appreciate any pointers to get this flex layout going with a functional window-scroller.
In the CodeSandbox you linked to (codesandbox.io/s/52j0vv936p)- window "scroll" events aren't reaching WindowScroller. That's because the window isn't actually what's scrollable, rather it's the middle "body" part. If that's what you want, you don't need to use WindowScroller at all and should remove it.
The only thing left that's broken is that your AutoSizer isn't getting a valid height because one of its parent <div>s doesn't have a correct height. For Stack Overflow convenience, here's the relevant bit:
Why is my AutoSizer setting a height of 0?
AutoSizer expands to fill its parent but it will not stretch the parent. This is done to prevent problems with flexbox layouts. If AutoSizer is reporting a height (or width) of 0- then it's likely that the parent element (or one of its parents) has a height of 0. One easy way to test this is to add a style property (eg background-color: red;) to the parent to ensure that it is the correct size. (eg You may need to add height: 100% or flex: 1 to the parent.)
Here is a diff to your sandbox that shows what I'm talking about and here is a fixed Code Sandbox demo.

CSS: Positioning components using margins

In the image below, you can see i have two tabs help and Instructions, i want to place these two tabs next to each other where the Help tab currently is. When i use the margin-left: property, only the help button moves to the left and the instructions button stays in the same place.
The css i am using to configure this:
.v-csslayout-topbarapplicant .v-button,
.v-csslayout-topbarapplicant .v-nativebutton,
.v-csslayout-topbarapplicant-invert .v-button,
.v-csslayout-topbarapplicant-invert .v-nativebutton {
float: right;
display: inline;
margin-right:0px;
margin-left: 268px;
margin-top: -18px;
padding: 0 3px 2px 0;
line-height: 11px;
}
How can i change the spacing so that both tabs (vaadin components) move together?
You need to make sure both items are wrapped with a div. Then you set the margin-left to that div, not only one of the items.
There's no way of telling in the CSS that you posted which items are being manipulated. If both of these items, "help" and "Instructions", are in the CSS you posted, then you to need to change it so that both items exist as one, meaning in one div. If only one of these items exist in your CSS that you posted, then you have only one of them being manipulated with the CSS, and that one is floating right. Ensure both items are floated in the same direction and they are wrapped. Apply the margin to this wrapper div.
The general structure should look like this:
CSS:
#help, #instructions {
float: right;
}
div#wrapper {
margin-left: 268px;
] /* wrapper containing both items, "help" and "Instructions" */
HTML:
<div id="wrapper">
<div id="help"></div>
<div id="instructions"></div>
</div>
I think that you are having some inheritance problems.
I would suggest first checking what inheritance this property is following, and if you still have problems I would then create separate divs for Help and Instructions, where instructions has a different right margin. I hope this helps! This type of problems are stubborn.

How to float elements in a masonry layout like magazine/newspaper?

I am trying to achieve a layout where items will float like newspaper/magazine article sections. It is something similar as what jQuery's Masonry does. But I was trying to achieve that only using CSS3. I thought perhaps the box display property could do it. Although after trying for few times, I wasn't able to make the items slide down after the parent column width as fulfilled.
Is there any way to achieve this layout only using CSS?
The markup would be something like this:
<article>
<section>...</section>
<section>...</section>
<section>...</section>
<section>...</section>
</article>
Here a section would float left and adjust itself on the columns queue where better fit (and not bellow the baseline of the previous one, as simple float does).
It's possible using CSS columns. Here is a good explanation.
CSS:
div{
-moz-column-count: 3;
-moz-column-gap: 10px;
-webkit-column-count: 3;
-webkit-column-gap: 10px;
column-count: 3;
column-gap: 10px;
width: 480px; }
div a{
display: inline-block; /* Display inline-block, and absolutely NO FLOATS! */
margin-bottom: 20px;
width: 100%; }
HTML:
<div>
Whatever stuff you want to put in here. Images, text, movies, what have you. No, really, anything!
...and so on and so forth ad nauseum.
</div>
Also, I found this site by searching "CSS Masonry" on Google. It was the second result.

Calculate value with CSS3

Is there any way to achieve this in CSS3?:
height: 100% -110px;
My context:
You can't calulate it with pure CSS. (it will not work in all browsers, as mentioned by Litek ) But there is a organizational way to handle this, but you will need to wrap you element in a other one:
body {
height; 100%;
padding: 0 0 20px;
}
div#wrap {
background: #fff;
height: 100%;
padding: 0 0 20px;
margin: 0 0 -20px;
}
div#wrap div { //this would be your actual element
height: 100%;
background: pink;
}
What you want to use is calc() that is comming to FF and propably webkit, but don't count on it being widely supported anytime soon.
As for your example, maybe sticky footer will be some inspiration for you.
Edit
Nowadays it's well supported by major browsers:
http://caniuse.com/calc
Directly like that i'm not aware of any feature widely adopted to do that.
But there is a easy method to achieve the effect.
Put all element inside a container <div> with 'height: 100%', this container should have position relative so you can position the other elements inside it relative to its position. place the header on top and the footer at bottom with absolute positioning and calculate with javascript the height that the content div must have.
You can also subscribe the 'window.onResize' event to recalculate when the window is resized.
I know this is not a clean and prety solution, but is the one the you can make work well in almost any browser.
In the context it was given the 2nd div height value doesn't really matter. Actually it's only important where that div starts and where it ends.
In other words height = vertical end - vertical start:
#div2 {
position:absolute;
top:90px;/*20+50+20*/
bottom:20px;
}
http://jsfiddle.net/cGwrw/3/

Resources