mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-06-04 19:45:35 +08:00
Merge pull request #54 from markrickert/version-0.6-trailing-spaces-cleanup
Clean up trailing spaces globally.
This commit is contained in:
@@ -14,7 +14,7 @@ class SplitViewController < UISplitViewController
|
||||
# set the button from the old detail screen to the new one
|
||||
button = detail_screen.navigationItem.leftBarButtonItem
|
||||
s.navigationItem.leftBarButtonItem = button
|
||||
|
||||
|
||||
self.viewControllers = [self.viewControllers.first, s.main_controller]
|
||||
end
|
||||
def screens=(s_array)
|
||||
|
||||
@@ -20,15 +20,15 @@ module ProMotion
|
||||
super
|
||||
self.view_did_appear(animated) if self.respond_to?("view_did_appear:")
|
||||
end
|
||||
|
||||
|
||||
def viewWillDisappear(animated)
|
||||
self.view_will_disappear(animated) if self.respond_to?("view_will_disappear:")
|
||||
super
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def viewDidDisappear(animated)
|
||||
self.view_did_disappear(animated) if self.respond_to?("view_did_disappear:")
|
||||
super
|
||||
super
|
||||
end
|
||||
|
||||
def shouldAutorotateToInterfaceOrientation(orientation)
|
||||
@@ -42,7 +42,7 @@ module ProMotion
|
||||
def willRotateToInterfaceOrientation(orientation, duration:duration)
|
||||
self.will_rotate(orientation, duration)
|
||||
end
|
||||
|
||||
|
||||
def didRotateFromInterfaceOrientation(orientation)
|
||||
self.on_rotate
|
||||
end
|
||||
|
||||
@@ -20,17 +20,17 @@ module ProMotion
|
||||
super
|
||||
self.view_did_appear(animated) if self.respond_to?("view_did_appear:")
|
||||
end
|
||||
|
||||
|
||||
def viewWillDisappear(animated)
|
||||
self.view_will_disappear(animated) if self.respond_to?("view_will_disappear:")
|
||||
super
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def viewDidDisappear(animated)
|
||||
if self.respond_to?("view_did_disappear:")
|
||||
self.view_did_disappear(animated)
|
||||
end
|
||||
super
|
||||
super
|
||||
end
|
||||
|
||||
def shouldAutorotateToInterfaceOrientation(orientation)
|
||||
@@ -44,7 +44,7 @@ module ProMotion
|
||||
def willRotateToInterfaceOrientation(orientation, duration:duration)
|
||||
self.will_rotate(orientation, duration)
|
||||
end
|
||||
|
||||
|
||||
def didRotateFromInterfaceOrientation(orientation)
|
||||
self.on_rotate
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ module ProMotion
|
||||
include ProMotion::ScreenTabs
|
||||
include ProMotion::SplitScreen if NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].include?("2")
|
||||
attr_accessor :window
|
||||
|
||||
|
||||
def application(application, didFinishLaunchingWithOptions:launch_options)
|
||||
return true if RUBYMOTION_ENV == "test"
|
||||
|
||||
@@ -15,7 +15,7 @@ module ProMotion
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
|
||||
def app_delegate
|
||||
UIApplication.sharedApplication.delegate
|
||||
end
|
||||
@@ -50,7 +50,7 @@ module ProMotion
|
||||
get_home_screen.send(:on_load) if get_home_screen.respond_to?(:on_load)
|
||||
load_root_screen get_home_screen
|
||||
end
|
||||
|
||||
|
||||
def get_home_screen
|
||||
@home_screen
|
||||
end
|
||||
|
||||
@@ -3,15 +3,15 @@ module ProMotion
|
||||
NAME = "RubyMotion::Console: "
|
||||
DEFAULT_COLOR = [ '', '' ]
|
||||
RED_COLOR = [ "\e[0;31m", "\e[0m" ] # Must be in double quotes
|
||||
GREEN_COLOR = [ "\e[0;32m", "\e[0m" ]
|
||||
PURPLE_COLOR = [ "\e[0;35m", "\e[0m" ]
|
||||
GREEN_COLOR = [ "\e[0;32m", "\e[0m" ]
|
||||
PURPLE_COLOR = [ "\e[0;35m", "\e[0m" ]
|
||||
|
||||
class << self
|
||||
def log(log, with_color:color)
|
||||
return if RUBYMOTION_ENV == "test"
|
||||
puts color[0] + NAME + log + color[1]
|
||||
end
|
||||
|
||||
|
||||
def log(log, withColor:color)
|
||||
return if RUBYMOTION_ENV == "test"
|
||||
warn "[DEPRECATION] `log(log, withColor:color)` is deprecated. Use `log(log, with_color:color)`"
|
||||
|
||||
@@ -22,13 +22,13 @@ module ProMotion::MotionTable
|
||||
@contacts_search_display_controller.delegate = params[:delegate]
|
||||
@contacts_search_display_controller.searchResultsDataSource = params[:data_source]
|
||||
@contacts_search_display_controller.searchResultsDelegate = params[:search_results_delegate]
|
||||
|
||||
|
||||
self.table_view.tableHeaderView = search_bar
|
||||
end
|
||||
alias :makeSearchable :make_searchable
|
||||
|
||||
######### iOS methods, headless camel case #######
|
||||
|
||||
|
||||
def searchDisplayController(controller, shouldReloadTableForSearchString:search_string)
|
||||
@mt_filtered_data = nil
|
||||
@mt_filtered_data = []
|
||||
|
||||
@@ -55,7 +55,7 @@ module ProMotion::MotionTable
|
||||
ProMotion::Console.log("Action not implemented: #{action.to_s}", with_color: ProMotion::Console::RED_COLOR)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def set_cell_attributes(element, args = {})
|
||||
args.each do |k, v|
|
||||
if v.is_a? Hash
|
||||
@@ -78,7 +78,7 @@ module ProMotion::MotionTable
|
||||
data_cell[:arguments] = {} unless data_cell[:arguments]
|
||||
data_cell[:arguments][:value] = switch.isOn if data_cell[:arguments].is_a? Hash
|
||||
data_cell[:accessory_action] ||= data_cell[:accessoryAction] # For legacy support
|
||||
|
||||
|
||||
trigger_action(data_cell[:accessory_action], data_cell[:arguments]) if data_cell[:accessory_action]
|
||||
end
|
||||
|
||||
@@ -105,14 +105,14 @@ module ProMotion::MotionTable
|
||||
# Set table_data_index if you want the right hand index column (jumplist)
|
||||
def sectionIndexTitlesForTableView(table_view)
|
||||
if self.respond_to?(:table_data_index)
|
||||
self.table_data_index
|
||||
self.table_data_index
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def remap_data_cell(data_cell)
|
||||
# Re-maps legacy data cell calls
|
||||
mappings = {
|
||||
cell_style: :cellStyle,
|
||||
mappings = {
|
||||
cell_style: :cellStyle,
|
||||
cell_identifier: :cellIdentifier,
|
||||
cell_class: :cellClass,
|
||||
masks_to_bounds: :masksToBounds,
|
||||
@@ -143,9 +143,9 @@ module ProMotion::MotionTable
|
||||
|
||||
data_cell = cell_at_section_and_index(indexPath.section, indexPath.row)
|
||||
return UITableViewCell.alloc.init unless data_cell
|
||||
|
||||
|
||||
data_cell = self.remap_data_cell(data_cell)
|
||||
|
||||
|
||||
data_cell[:cell_style] ||= UITableViewCellStyleDefault
|
||||
data_cell[:cell_identifier] ||= "Cell"
|
||||
cell_identifier = data_cell[:cell_identifier]
|
||||
@@ -154,7 +154,7 @@ module ProMotion::MotionTable
|
||||
table_cell = table_view.dequeueReusableCellWithIdentifier(cell_identifier)
|
||||
unless table_cell
|
||||
table_cell = data_cell[:cell_class].alloc.initWithStyle(data_cell[:cell_style], reuseIdentifier:cell_identifier)
|
||||
|
||||
|
||||
# Add optimizations here
|
||||
table_cell.layer.masksToBounds = true if data_cell[:masks_to_bounds]
|
||||
table_cell.backgroundColor = data_cell[:background_color] if data_cell[:background_color]
|
||||
@@ -165,7 +165,7 @@ module ProMotion::MotionTable
|
||||
if data_cell[:cell_class_attributes]
|
||||
set_cell_attributes table_cell, data_cell[:cell_class_attributes]
|
||||
end
|
||||
|
||||
|
||||
if data_cell[:accessory_view]
|
||||
table_cell.accessoryView = data_cell[:accessory_view]
|
||||
table_cell.accessoryView.autoresizingMask = UIViewAutoresizingFlexibleWidth
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module ProMotion::MotionTable
|
||||
module GroupedTable
|
||||
include SectionedTable
|
||||
|
||||
|
||||
def table_view
|
||||
@table_view ||= UITableView.alloc.initWithFrame(self.view.frame, style:UITableViewStyleGrouped)
|
||||
@table_view.dataSource = self;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module ProMotion
|
||||
module ScreenElements
|
||||
include ProMotion::ViewHelper
|
||||
|
||||
|
||||
def add(v, attrs = {})
|
||||
if attrs && attrs.length > 0
|
||||
set_attributes(v, attrs)
|
||||
@@ -22,7 +22,7 @@ module ProMotion
|
||||
def bounds
|
||||
return self.view.bounds
|
||||
end
|
||||
|
||||
|
||||
def frame
|
||||
return self.view.frame
|
||||
end
|
||||
|
||||
@@ -2,20 +2,20 @@ module ProMotion
|
||||
module ScreenNavigation
|
||||
|
||||
def open_screen(screen, args = {})
|
||||
|
||||
|
||||
# Apply properties to instance
|
||||
screen = setup_screen_for_open(screen, args)
|
||||
ensure_wrapper_controller_in_place(screen, args)
|
||||
|
||||
screen.send(:on_load) if screen.respond_to?(:on_load)
|
||||
screen.send(:on_load) if screen.respond_to?(:on_load)
|
||||
animated = args[:animated] || true
|
||||
|
||||
return self.split_screen.detail_screen = screen if args[:in_detail] && self.split_screen
|
||||
return self.split_screen.master_screen = screen if args[:in_master] && self.split_screen
|
||||
|
||||
|
||||
if args[:close_all]
|
||||
open_root_screen screen
|
||||
|
||||
|
||||
elsif args[:modal]
|
||||
present_modal_view_controller screen, animated
|
||||
|
||||
@@ -44,7 +44,7 @@ module ProMotion
|
||||
def app_delegate
|
||||
UIApplication.sharedApplication.delegate
|
||||
end
|
||||
|
||||
|
||||
def close_screen(args = {})
|
||||
args ||= {}
|
||||
args[:animated] ||= true
|
||||
@@ -58,7 +58,7 @@ module ProMotion
|
||||
|
||||
else
|
||||
Console.log("Tried to close #{self.to_s}; however, this screen isn't modal or in a nav bar.", withColor: Console::PURPLE_COLOR)
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
alias :close :close_screen
|
||||
@@ -95,7 +95,7 @@ module ProMotion
|
||||
screen.parent_screen = self if screen.respond_to?("parent_screen=")
|
||||
screen.title = args[:title] if args[:title] && screen.respond_to?("title=")
|
||||
screen.modal = args[:modal] if args[:modal] && screen.respond_to?("modal=")
|
||||
|
||||
|
||||
# Hide bottom bar?
|
||||
screen.hidesBottomBarWhenPushed = args[:hide_tab_bar] == true
|
||||
|
||||
|
||||
@@ -10,33 +10,33 @@ module ProMotion
|
||||
|
||||
screens.each do |s|
|
||||
s = s.new if s.respond_to?(:new)
|
||||
|
||||
|
||||
s.tabBarItem.tag = tag_index
|
||||
|
||||
|
||||
s.parent_screen = self if self.is_a?(UIViewController) && s.respond_to?("parent_screen=")
|
||||
s.tab_bar = tab_bar_controller if s.respond_to?("tab_bar=")
|
||||
|
||||
|
||||
vc = s.respond_to?(:main_controller) ? s.main_controller : s
|
||||
view_controllers << vc
|
||||
|
||||
|
||||
tag_index += 1
|
||||
|
||||
|
||||
s.on_load if s.respond_to?(:on_load)
|
||||
end
|
||||
|
||||
tab_bar_controller.viewControllers = view_controllers
|
||||
tab_bar_controller
|
||||
end
|
||||
|
||||
|
||||
# Open a UITabBarController with the specified screens as the
|
||||
# root view controller of the current app.
|
||||
# @param [Array] A comma-delimited list of screen classes or instances.
|
||||
# @return [UITabBarController]
|
||||
def open_tab_bar(*screens)
|
||||
tab_bar = tab_bar_controller(*screens)
|
||||
|
||||
|
||||
a = self.respond_to?(:load_root_screen) ? self : UIApplication.sharedApplication.delegate
|
||||
|
||||
|
||||
a.load_root_screen(tab_bar)
|
||||
tab_bar
|
||||
end
|
||||
@@ -66,12 +66,12 @@ module ProMotion
|
||||
title = tab[:title] if tab[:title]
|
||||
tab[:tag] ||= @current_tag ||= 0
|
||||
@current_tag = tab[:tag] + 1
|
||||
|
||||
|
||||
tab_bar_item = create_tab_bar_icon(tab[:system_icon], tab[:tag]) if tab[:system_icon]
|
||||
tab_bar_item = create_tab_bar_icon_custom(title, tab[:icon], tab[:tag]) if tab[:icon]
|
||||
|
||||
|
||||
tab_bar_item.badgeValue = tab[:badge_number].to_s unless tab[:badge_number].nil? || tab[:badge_number] <= 0
|
||||
|
||||
|
||||
return tab_bar_item
|
||||
end
|
||||
|
||||
|
||||
@@ -3,20 +3,20 @@ module ProMotion
|
||||
def split_screen_controller(master, detail)
|
||||
master_main = master.navigationController ? master.navigationController : master
|
||||
detail_main = detail.navigationController ? detail.navigationController : detail
|
||||
|
||||
|
||||
split = SplitViewController.alloc.init
|
||||
split.viewControllers = [ master_main, detail_main ]
|
||||
split.delegate = self
|
||||
|
||||
|
||||
split
|
||||
end
|
||||
|
||||
|
||||
def create_split_screen(master, detail, args={})
|
||||
master = master.new if master.respond_to?(:new)
|
||||
detail = detail.new if detail.respond_to?(:new)
|
||||
|
||||
|
||||
split = split_screen_controller(master, detail)
|
||||
|
||||
|
||||
[master, detail].each do |s|
|
||||
s.split_screen = split if s.respond_to?("split_screen=")
|
||||
s.on_load if s.respond_to?(:on_load)
|
||||
@@ -24,15 +24,15 @@ module ProMotion
|
||||
|
||||
split
|
||||
end
|
||||
|
||||
|
||||
def open_split_screen(master, detail, args={})
|
||||
split = create_split_screen(master, detail, args)
|
||||
open split, args
|
||||
split
|
||||
end
|
||||
|
||||
|
||||
# UISplitViewControllerDelegate methods
|
||||
|
||||
|
||||
def splitViewController(svc, willHideViewController: vc, withBarButtonItem: button, forPopoverController: pc)
|
||||
button.title = vc.title
|
||||
svc.detail_screen.navigationItem.leftBarButtonItem = button;
|
||||
|
||||
@@ -12,13 +12,13 @@ module ProMotion
|
||||
unless self.is_a?(UIViewController)
|
||||
raise StandardError.new("ERROR: Screens must extend UIViewController or a subclass of UIViewController.")
|
||||
end
|
||||
|
||||
|
||||
args.each do |k, v|
|
||||
self.send("#{k}=", v) if self.respond_to?("#{k}=")
|
||||
end
|
||||
|
||||
self.add_nav_bar if args[:nav_bar]
|
||||
self.table_setup if self.respond_to?(:table_setup)
|
||||
self.table_setup if self.respond_to?(:table_setup)
|
||||
self.on_init if self.respond_to?(:on_init)
|
||||
self
|
||||
end
|
||||
@@ -186,7 +186,7 @@ module ProMotion
|
||||
end
|
||||
orientations
|
||||
end
|
||||
|
||||
|
||||
def supported_device_families
|
||||
NSBundle.mainBundle.infoDictionary["UIDeviceFamily"].map do |m|
|
||||
case m
|
||||
@@ -197,7 +197,7 @@ module ProMotion
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def supported_device_family?(family)
|
||||
supported_device_families.include?(family)
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ module ProMotion
|
||||
include MotionTable::PlainTable
|
||||
include MotionTable::SearchableTable
|
||||
include ProMotion::ScreenModule
|
||||
|
||||
|
||||
def update_table_data
|
||||
self.update_table_view_data(table_data)
|
||||
end
|
||||
|
||||
@@ -24,5 +24,5 @@ describe "ios version" do
|
||||
it "#ios_version_less_eq?" do
|
||||
@dummy.ios_version_less_eq?(@dummy.ios_version).should == true
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ describe "pro motion module" do
|
||||
it "should have 'PM' module" do
|
||||
should.not.raise(NameError) { PM }
|
||||
end
|
||||
|
||||
|
||||
it "should not allow screen inclusion into just any class" do
|
||||
dummy = DummyClass.new
|
||||
dummy.extend ProMotion::ScreenModule
|
||||
|
||||
@@ -2,48 +2,48 @@ describe "split screen in tab bar functionality" do
|
||||
|
||||
before do
|
||||
@app = TestDelegate.new
|
||||
|
||||
|
||||
@master_screen = HomeScreen.new nav_bar: true
|
||||
@detail_screen = BasicScreen.new nav_bar: true
|
||||
|
||||
|
||||
@split_screen = @app.create_split_screen @master_screen, @detail_screen
|
||||
@tab = @app.open_tab_bar @split_screen, HomeScreen, BasicScreen
|
||||
end
|
||||
|
||||
|
||||
it "should create a UISplitViewController" do
|
||||
@split_screen.is_a?(UISplitViewController).should == true
|
||||
end
|
||||
|
||||
|
||||
it "should have two viewControllers" do
|
||||
@split_screen.viewControllers.length.should == 2
|
||||
end
|
||||
|
||||
|
||||
it "should set the root view to the tab bar" do
|
||||
@app.window.rootViewController.should == @tab
|
||||
end
|
||||
|
||||
it "should return screens for the master_screen and detail_screen methods" do
|
||||
|
||||
it "should return screens for the master_screen and detail_screen methods" do
|
||||
@split_screen.master_screen.is_a?(PM::Screen).should == true
|
||||
@split_screen.detail_screen.is_a?(PM::Screen).should == true
|
||||
end
|
||||
|
||||
it "should return navigationControllers" do
|
||||
|
||||
it "should return navigationControllers" do
|
||||
@split_screen.viewControllers.first.is_a?(UINavigationController).should == true
|
||||
@split_screen.viewControllers.last.is_a?(UINavigationController).should == true
|
||||
end
|
||||
|
||||
|
||||
it "should set the first viewController to HomeScreen's main controller" do
|
||||
@split_screen.master_screen.should == @master_screen
|
||||
@split_screen.viewControllers.first.should == @master_screen.main_controller
|
||||
end
|
||||
|
||||
|
||||
it "should set the second viewController to BasicScreen's main controller" do
|
||||
@split_screen.detail_screen.should == @detail_screen
|
||||
@split_screen.viewControllers.last.should == @detail_screen.main_controller
|
||||
end
|
||||
|
||||
it "should set the tab bar first viewController to the split screen" do
|
||||
|
||||
it "should set the tab bar first viewController to the split screen" do
|
||||
@tab.viewControllers.first.should == @split_screen
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -2,45 +2,45 @@ describe "split screen `open` functionality" do
|
||||
|
||||
before do
|
||||
@app = TestDelegate.new
|
||||
|
||||
|
||||
@master_screen = HomeScreen.new nav_bar: true
|
||||
@detail_screen_1 = BasicScreen.new # no nav_bar on this one
|
||||
@detail_screen_2 = BasicScreen.new(nav_bar: true)
|
||||
|
||||
|
||||
@split_screen = @app.open_split_screen @master_screen, @detail_screen_1
|
||||
end
|
||||
|
||||
|
||||
it "should open a new screen in the detail view" do
|
||||
@master_screen.open @detail_screen_2, in_detail: true
|
||||
@split_screen.detail_screen.should == @detail_screen_2
|
||||
@split_screen.viewControllers.first.should == @master_screen.main_controller
|
||||
@split_screen.viewControllers.last.should == @detail_screen_2.main_controller
|
||||
end
|
||||
|
||||
|
||||
it "should open a new screen in the master view" do
|
||||
@detail_screen_1.open @detail_screen_2, in_master: true
|
||||
@split_screen.master_screen.should == @detail_screen_2
|
||||
@split_screen.viewControllers.first.should == @detail_screen_2.main_controller
|
||||
@split_screen.viewControllers.last.should == @detail_screen_1.main_controller
|
||||
end
|
||||
|
||||
|
||||
it "should open a new screen in the master view's navigation controller" do
|
||||
@master_screen.open @detail_screen_2
|
||||
@split_screen.detail_screen.should == @detail_screen_1 # no change
|
||||
@master_screen.navigationController.topViewController.should == @detail_screen_2
|
||||
end
|
||||
|
||||
|
||||
it "should open a new modal screen in the detail view" do
|
||||
@detail_screen_1.open @detail_screen_2, modal: true
|
||||
@split_screen.detail_screen.should == @detail_screen_1
|
||||
@detail_screen_1.presentedViewController.should == @detail_screen_2.main_controller
|
||||
end
|
||||
|
||||
it "should not interfere with normal non-split screen navigation" do
|
||||
|
||||
it "should not interfere with normal non-split screen navigation" do
|
||||
home = HomeScreen.new(nav_bar: true)
|
||||
child = BasicScreen.new
|
||||
home.open child, in_detail: true, in_master: true
|
||||
home.navigation_controller.topViewController.should == child
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -2,34 +2,34 @@ describe "split screen functionality" do
|
||||
|
||||
before do
|
||||
@app = TestDelegate.new
|
||||
|
||||
|
||||
@master_screen = HomeScreen.new nav_bar: true
|
||||
@detail_screen = BasicScreen.new # no nav_bar on this one
|
||||
|
||||
|
||||
@split_screen = @app.open_split_screen @master_screen, @detail_screen
|
||||
end
|
||||
|
||||
|
||||
it "should have created a split screen" do
|
||||
@split_screen.should != nil
|
||||
@split_screen.is_a?(UISplitViewController).should == true
|
||||
end
|
||||
|
||||
|
||||
it "should have two viewControllers" do
|
||||
@split_screen.viewControllers.length.should == 2
|
||||
end
|
||||
|
||||
|
||||
it "should set the root view to the UISplitScreenViewController" do
|
||||
@app.window.rootViewController.should == @split_screen
|
||||
end
|
||||
|
||||
|
||||
it "should set the first viewController to HomeScreen" do
|
||||
@split_screen.master_screen.should == @master_screen
|
||||
@split_screen.viewControllers.first.should == @master_screen.main_controller
|
||||
end
|
||||
|
||||
|
||||
it "should set the second viewController to BasicScreen" do
|
||||
@split_screen.detail_screen.should == @detail_screen
|
||||
@split_screen.viewControllers.last.should == @detail_screen.main_controller
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -3,7 +3,7 @@ describe "view helpers" do
|
||||
def equal_rect(rect)
|
||||
->(obj) { CGRectEqualToRect obj, rect }
|
||||
end
|
||||
|
||||
|
||||
before do
|
||||
@dummy = UIView.alloc.initWithFrame CGRectZero
|
||||
@dummy.extend ProMotion::ViewHelper
|
||||
@@ -14,7 +14,7 @@ describe "view helpers" do
|
||||
end
|
||||
|
||||
it "#frame_from_array should return a valid CGRect" do
|
||||
@dummy.frame_from_array([0,0,320,480]).should equal_rect(CGRectMake(0,0,320,480))
|
||||
@dummy.frame_from_array([0,0,320,480]).should equal_rect(CGRectMake(0,0,320,480))
|
||||
end
|
||||
|
||||
it "should allow you to set attributes" do
|
||||
@@ -24,16 +24,16 @@ describe "view helpers" do
|
||||
|
||||
it "should allow you to set nested attributes" do
|
||||
layered_view = UIView.alloc.initWithFrame(CGRectMake(0, 0, 10, 10))
|
||||
|
||||
|
||||
@dummy.set_attributes layered_view, {
|
||||
layer: {
|
||||
backgroundColor: UIColor.redColor.CGColor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
layered_view.layer.backgroundColor.should == UIColor.redColor.CGColor
|
||||
end
|
||||
|
||||
|
||||
it "should allow you to set multiple nested attributes" do
|
||||
mask_layer = CAShapeLayer.layer
|
||||
layered_view = UIView.alloc.initWithFrame(CGRectMake(0, 0, 10, 10))
|
||||
@@ -45,10 +45,10 @@ describe "view helpers" do
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
layered_view.layer.mask.backgroundColor.should == UIColor.redColor.CGColor
|
||||
end
|
||||
|
||||
|
||||
describe "content height" do
|
||||
|
||||
before do
|
||||
|
||||
Reference in New Issue
Block a user