Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dolt #18846

Closed
wants to merge 6 commits into from
Closed

Dolt #18846

Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Parse sizes attribute- Updates

  • Loading branch information
Rakhisharma committed Sep 25, 2017
commit ce14eab6f4ebced766c9d4b6e274982503eabac9
@@ -74,6 +74,7 @@ enum State {
CompletelyAvailable,
Broken,
}

#[derive(PartialEq)]
#[derive(Debug)]
pub struct Size {
@@ -822,7 +823,7 @@ pub fn parse_a_sizes_attribute(input: DOMString, width: Option<u32>) -> Vec<Size
let mut media_query_parser = parser;
let media_query = media_query_parser.try(|i| MediaQuery::parse(&context, i));
if let Ok(query) = media_query {
let length = Length::parse_non_negative(&context, &mut media_query_parser);
let length = Length::parse_non_negative(&context, &mut media_query_parser);
if let Ok(length) = length {
sizes.push(Size {
length: length,
@@ -17,12 +17,11 @@ pub fn test_length_for_no_default_provided(len: f32) -> Length {

#[test]
fn no_default_provided() {
let mut a = vec![];
let a = vec![size];
let length = test_length_for_no_default_provided(100f32);
let size = Size { query: None, length: length };
a.push(size);
assert_eq!(parse_a_sizes_attribute(DOMString::new(), None), a);
println!("{:?}", parse_a_sizes_attribute(DOMString::new(), None));
}

pub fn test_length_for_default_provided(len: f32) -> Length {
@@ -32,12 +31,11 @@ pub fn test_length_for_default_provided(len: f32) -> Length {

#[test]
fn default_provided() {
let mut a = vec![];
let a = vec![size];
let length = test_length_for_default_provided(2f32);
let size = Size { query: None, length: length };
a.push(size);
assert_eq!(parse_a_sizes_attribute(DOMString::new(), Some(2)), a);
println!("{:?}", parse_a_sizes_attribute(DOMString::new(), Some(2)));
}

pub fn test_media_query(len: f32) -> MediaQuery {
@@ -58,7 +56,7 @@ pub fn test_length(len: f32) -> Length {

#[test]
fn one_value() {
let mut a = vec![];
let a = vec![size];
let media_query = test_media_query(200f32);
let length = test_length(545f32);
let size = Size { query: Some(media_query), length: length };
@@ -81,7 +79,7 @@ fn more_then_one_value() {

#[test]
fn no_extra_whitespace() {
let mut a = vec![];
let a = vec![size];
let media_query = test_media_query(200f32);
let length = test_length(545f32);
let size = Size { query: Some(media_query), length: length };
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.